1
z8018
2025-05-06 7da6f394864ba0412c1ac58ba7752862de7d3f3d
ÏîÄ¿´úÂë/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Gantry/GantryJob.cs
@@ -62,6 +62,11 @@
                            if (takePositions.Length != 5)
                            {
                                WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}", "取货位置错误");
                                if (task.ExceptionMessage?.Contains("取货位置错误") ?? true)
                                {
                                    task.ExceptionMessage = "取货位置错误";
                                    _taskRepository.UpdateData(task);
                                }
                                return Task.CompletedTask;
                            }
@@ -69,6 +74,11 @@
                            if (putPositions.Length != 5)
                            {
                                WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}", "放货位置错误");
                                if (task.ExceptionMessage?.Contains("放货位置错误") ?? true)
                                {
                                    task.ExceptionMessage = "放货位置错误";
                                    _taskRepository.UpdateData(task);
                                }
                                return Task.CompletedTask;
                            }
@@ -76,17 +86,32 @@
                            if (containerItem == null)
                            {
                                WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}", "板材尺寸获取错误");
                                if (task.ExceptionMessage?.Contains("板材尺寸获取错误") ?? true)
                                {
                                    task.ExceptionMessage = "板材尺寸获取错误";
                                    _taskRepository.UpdateData(task);
                                }
                                return Task.CompletedTask;
                            }
                            if (!LightStatusStorage.StationStautsDic.TryGetValue(putPositions[0],out bool stationStatus))
                            {
                                WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}", $"工位【{putPositions[0]}】有无垫板数据错误,{LightStatusStorage.StationStautsDic.Serialize()}");
                                if (task.ExceptionMessage?.Contains($"工位【{putPositions[0]}】有无垫板数据错误") ?? true)
                                {
                                    task.ExceptionMessage = $"工位【{putPositions[0]}】有无垫板数据错误";
                                    _taskRepository.UpdateData(task);
                                }
                                return Task.CompletedTask;
                            }
                            if (!stationStatus)
                            {
                                WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}", $"工位【{putPositions[0]}】无垫板,{LightStatusStorage.StationStautsDic.Serialize()}");
                                if (task.ExceptionMessage?.Contains($"工位【{putPositions[0]}】无垫板") ?? true)
                                {
                                    task.ExceptionMessage = $"工位【{putPositions[0]}】无垫板";
                                    _taskRepository.UpdateData(task);
                                }
                                return Task.CompletedTask;
                            }
                            
@@ -96,7 +121,12 @@
                            if (OPositions.HPositions[takePositions[0]].PositionZ == 0)
                            {
                                WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}", "取货Z坐标读取为0");
                                WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}", "读取取货Z坐标读取为0");
                                if (task.ExceptionMessage?.Contains($"读取取货Z坐标读取为0") ?? true)
                                {
                                    task.ExceptionMessage = $"读取取货Z坐标读取为0";
                                    _taskRepository.UpdateData(task);
                                }
                                return Task.CompletedTask;
                            }
@@ -108,7 +138,12 @@
                            if (OPositions.HPositions[takePositions[0]].PositionZ == 0)
                            {
                                WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}", "放货Z坐标读取为0");
                                WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}", "读取放货Z坐标读取为0");
                                if (task.ExceptionMessage?.Contains($"读取放货Z坐标读取为0") ?? true)
                                {
                                    task.ExceptionMessage = $"读取放货Z坐标读取为0";
                                    _taskRepository.UpdateData(task);
                                }
                                return Task.CompletedTask;
                            }
                            int putPoR = 0;
@@ -140,6 +175,11 @@
                                    else
                                    {
                                        WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}", "R坐标错误");
                                        if (task.ExceptionMessage?.Contains($"R坐标错误") ?? true)
                                        {
                                            task.ExceptionMessage = $"R坐标错误";
                                            _taskRepository.UpdateData(task);
                                        }
                                        return Task.CompletedTask;
                                    }
                                }
@@ -164,6 +204,11 @@
                            if(devicePro == null)
                            {
                                WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}", "设备协议参数错误,未找到最大最小坐标地址");
                                if (task.ExceptionMessage?.Contains($"设备协议参数错误,未找到最大最小坐标地址") ?? true)
                                {
                                    task.ExceptionMessage = $"设备协议参数错误,未找到最大最小坐标地址";
                                    _taskRepository.UpdateData(task);
                                }
                                return Task.CompletedTask;
                            }
                            int[] data = otherDevice.Communicator.Read<int>(devicePro.DeviceProAddress, (ushort)(devicePros.Count));
@@ -190,48 +235,88 @@
                            if (takePoX < minX || takePoX > maxX)
                            {
                                WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}-坐标", $"X取货坐标超出范围,取货坐标:{takePoX},最大值:{maxX},最小值:{minX}");
                                if (task.ExceptionMessage?.Contains($"X取货坐标超出范围,取货坐标:{takePoX},最大值:{maxX},最小值:{minX}") ?? true)
                                {
                                    task.ExceptionMessage = $"X取货坐标超出范围,取货坐标:{takePoX},最大值:{maxX},最小值:{minX}";
                                    _taskRepository.UpdateData(task);
                                }
                                return Task.CompletedTask;
                            }
                            if (putPoX < minX || putPoX > maxX)
                            {
                                WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}-坐标", $"X放货坐标超出范围,取货坐标:{putPoX},最大值:{maxX},最小值:{minX}");
                                if (task.ExceptionMessage?.Contains($"X放货坐标超出范围,取货坐标:{putPoX},最大值:{maxX},最小值:{minX}") ?? true)
                                {
                                    task.ExceptionMessage = $"X放货坐标超出范围,取货坐标:{putPoX},最大值:{maxX},最小值:{minX}";
                                    _taskRepository.UpdateData(task);
                                }
                                return Task.CompletedTask;
                            }
                            if (takePoY < minY || takePoY > maxY)
                            {
                                WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}-坐标", $"Y取货坐标超出范围,取货坐标:{takePoY},最大值:{maxY},最小值:{minY}");
                                if (task.ExceptionMessage?.Contains($"Y取货坐标超出范围,取货坐标:{takePoY},最大值:{maxY},最小值:{minY}") ?? true)
                                {
                                    task.ExceptionMessage = $"Y取货坐标超出范围,取货坐标:{takePoY},最大值:{maxY},最小值:{minY}";
                                    _taskRepository.UpdateData(task);
                                }
                                return Task.CompletedTask;
                            }
                            if (putPoY < minY || putPoY > maxY)
                            {
                                WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}-坐标", $"Y放货坐标超出范围,取货坐标:{putPoY},最大值:{maxY},最小值:{minY}");
                                if (task.ExceptionMessage?.Contains($"Y放货坐标超出范围,取货坐标:{putPoY},最大值:{maxY},最小值:{minY}") ?? true)
                                {
                                    task.ExceptionMessage = $"Y放货坐标超出范围,取货坐标:{putPoY},最大值:{maxY},最小值:{minY}";
                                    _taskRepository.UpdateData(task);
                                }
                                return Task.CompletedTask;
                            }
                            if (takePoZ < minZ || takePoZ > maxZ)
                            {
                                WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}-坐标", $"Z取货坐标超出范围,取货坐标:{takePoZ},最大值:{maxZ},最小值:{minZ}");
                                if (task.ExceptionMessage?.Contains($"Z取货坐标超出范围,取货坐标:{takePoZ},最大值:{maxZ},最小值:{minZ}") ?? true)
                                {
                                    task.ExceptionMessage = $"Z取货坐标超出范围,取货坐标:{takePoZ},最大值:{maxZ},最小值:{minZ}";
                                    _taskRepository.UpdateData(task);
                                }
                                return Task.CompletedTask;
                            }
                            if (putPoZ < minZ || putPoZ > maxZ)
                            {
                                WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}-坐标", $"Z放货坐标超出范围,取货坐标:{putPoZ},最大值:{maxZ},最小值:{minZ}");
                                if (task.ExceptionMessage?.Contains($"Z放货坐标超出范围,取货坐标:{putPoZ},最大值:{maxZ},最小值:{minZ}") ?? true)
                                {
                                    task.ExceptionMessage = $"Z放货坐标超出范围,取货坐标:{putPoZ},最大值:{maxZ},最小值:{minZ}";
                                    _taskRepository.UpdateData(task);
                                }
                                return Task.CompletedTask;
                            }
                            if (takePoR < minR || takePoR > maxR)
                            {
                                WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}-坐标", $"R取货坐标超出范围,取货坐标:{takePoR},最大值:{maxR},最小值:{minR}");
                                if (task.ExceptionMessage?.Contains($"R取货坐标超出范围,取货坐标:{takePoR},最大值:{maxR},最小值:{minR}") ?? true)
                                {
                                    task.ExceptionMessage = $"R取货坐标超出范围,取货坐标:{takePoR},最大值:{maxR},最小值:{minR}";
                                    _taskRepository.UpdateData(task);
                                }
                                return Task.CompletedTask;
                            }
                            if (putPoR < minR || putPoR > maxR)
                            {
                                WriteError($"{otherDevice.DeviceCode}-{otherDevice.DeviceName}-坐标", $"R放货坐标超出范围,取货坐标:{putPoR},最大值:{maxR},最小值:{minR}");
                                if (task.ExceptionMessage?.Contains($"R放货坐标超出范围,取货坐标:{putPoR},最大值:{maxR},最小值:{minR}") ?? true)
                                {
                                    task.ExceptionMessage = $"R放货坐标超出范围,取货坐标:{putPoR},最大值:{maxR},最小值:{minR}";
                                    _taskRepository.UpdateData(task);
                                }
                                return Task.CompletedTask;
                            }
                            #endregion