huanghongfeng
2024-11-22 426848306ad9233db96e4b3fc68a881c15f0b0b0
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -6,6 +6,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Eventing.Reader;
using System.Linq;
using System.Reflection.Metadata;
using System.Text;
@@ -259,6 +260,7 @@
                            int B_Event_Test = GetLine(conveyorLine, deviceProDTO.DeviceProDataBlock);        //判断输送线是否允许放货信号
                            if (B_Event_Test == 1)
                            {
                                if (Releasespermitted(commonStackerCrane, task.TargetAddress,true))  //写入堆垛机允许放货信
                                {
                                    WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入堆垛机允许放货信号成功:true", $"(放货)写入{task.TargetAddress}");
@@ -305,6 +307,9 @@
                                    if (B_TAKE == 1)
                                    {
                                        //堆垛机写完成
                                        if (Releasespermitted4(commonStackerCrane, task.TargetAddress, true))
                                        {
@@ -314,6 +319,43 @@
                                        {
                                            WriteLog.GetLog("堆垛机信号").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入堆垛机放下信号失败:true", $"(放货)写入{task.TargetAddress}");
                                        }
                                        if (task.TargetAddress == "R02-002-027-011-01" || task.TargetAddress == "R01-002-041-011-01")   //写入输送线去向
                                        {
                                            byte PLCtost = (byte)task.PLCTo;
                                            while (true)
                                            {
                                                if (PLCSignal2(conveyorLine, task.TargetAddress, "W_Destination", PLCtost))
                                                {
                                                    WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入去向成功,去向为:{PLCtost}", $"出料口去向");
                                                    DeviceProDTO? deviceProDTO3 = GetDeviceProDTO(conveyorLine, task.TargetAddress, "R_Destination");
                                                    if (deviceProDTO3 != null)
                                                    {
                                                        int PLCwcstost = GetLine(conveyorLine, deviceProDTO3.DeviceProDataBlock);
                                                        if (PLCwcstost == PLCtost)
                                                        {
                                                            if (PLCSignal2(conveyorLine, task.TargetAddress, "W_Destination", 0))
                                                            {
                                                                WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:清除去向成功", $"(放货)写入{task.TargetAddress}");
                                                                break;
                                                            }
                                                            else
                                                            {
                                                                WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:清除去向失败", $"(放货)写入{task.TargetAddress}");
                                                            }
                                                        }
                                                        else
                                                        {
                                                            WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:去向比对不一致,输送线去向为:{PLCwcstost},wcs写入去向为:{PLCtost}", $"(放货)写入{task.TargetAddress}");
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入去向失败,去向为:{PLCtost}", $"出料口去向");
                                                }
                                            }
                                        }
                                        // æ¸…除输送线
                                        if (PLCSignal(conveyorLine, task.TargetAddress, 0))
                                        {
@@ -322,6 +364,18 @@
                                        else
                                        {
                                            WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:写入输送线清除-堆垛机放下信号失败", $"(放货)读取{task.TargetAddress}");
                                        }
                                    }
                                    else
                                    {
                                        // æ¸…除输送线
                                        if (PLCSignal(conveyorLine, task.TargetAddress, 0))
                                        {
                                            WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:未读取到输送线反馈堆垛机完成反馈信号,重置为0", $"(放货)读取{task.TargetAddress}");
                                        }
                                        else
                                        {
                                            WriteLog.GetLog("输送线").Write($"站台编号:{task.TargetAddress},任务号:{task.TaskNum},信息:未读取到输送线反馈堆垛机完成反馈信号,重置为0", $"(放货)读取{task.TargetAddress}");
                                        }
                                    }
                                }
@@ -546,7 +600,7 @@
                    if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
                }
            }
            if (Destinationaddress == "R01-003-041-011-01")
            if (Destinationaddress == "R01-002-041-011-01")
            {
                DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryPermission_Dout");
                if (deviceProDTO != null)
@@ -646,7 +700,7 @@
            }
            if (Destinationaddress == "R02-002-027-011-01")
            {
                DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompletion_Din");
                DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompletion_Dout");
                if (deviceProDTO != null)
                {
                    if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
@@ -669,7 +723,7 @@
                    if (SetStacker(commonStackerCrane, deviceProDTO.DeviceProAddress, SCcrane).Status) { return true; }
                }
            }
            if (Destinationaddress == "R01-002-043-001-01")
            if (Destinationaddress == "R01-002-044-001-01")
            {
                DeviceProDTO? deviceProDTO = GetDeviceProDTO2(commonStackerCrane, commonStackerCrane.DeviceCode, "DeliveryCompletion_Aout");
                if (deviceProDTO != null)