This commit is contained in:
chi
2025-05-23 11:01:22 +09:00
parent 34130e9c86
commit 80cf98901b
10 changed files with 1921 additions and 1982 deletions

View File

@@ -24,7 +24,6 @@
<ProjectReference Include="..\SubProject\BMS\BMS.csproj" />
<ProjectReference Include="..\SubProject\CommData\CommData.csproj" />
<ProjectReference Include="..\SubProject\CommUtil\arCommUtil.csproj" />
<ProjectReference Include="..\SubProject\MSSQLCommand\MSSQLCommand.csproj" />
<ProjectReference Include="..\SubProject\Patch\SWPatch.csproj" />
</ItemGroup>

View File

@@ -8,6 +8,7 @@ using System.Speech.Synthesis;
using System.Media;
using System.Runtime.InteropServices;
using Microsoft.Data.SqlClient;
using System.Windows.Forms;
namespace Project
{
@@ -184,6 +185,11 @@ namespace Project
public static void init()
{
// 전역 예외 처리기 등록
Application.ThreadException += Application_ThreadException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.ApplicationExit += Application_ApplicationExit;
Result = new CResult();
//state machine
@@ -237,6 +243,47 @@ namespace Project
else PUB.PatchVersion = string.Empty;
}
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
try
{
string errorMessage = $"Thread Exception: {e.Exception.Message}\nStack Trace: {e.Exception.StackTrace}";
log.AddE(errorMessage);
MessageBox.Show($"프로그램 오류가 발생했습니다.\n{errorMessage}", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch
{
// 로깅 실패 시 무시
}
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
try
{
Exception ex = e.ExceptionObject as Exception;
string errorMessage = $"Unhandled Exception: {ex?.Message}\nStack Trace: {ex?.StackTrace}";
log.AddE(errorMessage);
MessageBox.Show($"프로그램 오류가 발생했습니다.\n{errorMessage}", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch
{
// 로깅 실패 시 무시
}
}
private static void Application_ApplicationExit(object sender, EventArgs e)
{
try
{
log.Add("프로그램 종료", "Application_ApplicationExit 이벤트 발생");
}
catch
{
// 로깅 실패 시 무시
}
}
public static Boolean CheckManualChargeMode(bool Prompt = true )
{
if (VAR.BOOL[eVarBool.FLAG_CHARGEONM] == true)

View File

@@ -196,9 +196,7 @@ namespace Project
case arDev.Narumi.DataType.TAG:
{
//자동 실행 중이다.
PUB.log.Add($"RFID값에서 위치정보를 추출할 수 있도록 해야한다");
PUB.Result.LastTAG = PUB.AGV.data.TagNo.ToString();
var curpos = ParsePosition(PUB.AGV.data.TagNo, out string dirForward);
@@ -214,6 +212,8 @@ namespace Project
ctlPos1.SetDirection(dirForward);
ctlPos1.Invalidate();
//pot not를 보면 일단 바로 멈추게한다
if (PUB.Result.CurrentPos == ePosition.POT || PUB.Result.CurrentPos == ePosition.NOT)
{

View File

@@ -66,6 +66,7 @@
// panel1
//
panel1.Dock = DockStyle.Fill;
panel1.Font = new Font("Tahoma", 8F, FontStyle.Bold);
panel1.Location = new Point(0, 0);
panel1.Name = "panel1";
panel1.Size = new Size(1014, 579);

View File

@@ -10,6 +10,7 @@ using System.Windows.Forms;
using Project.StateMachine;
using COMM;
using AR;
using Microsoft.IdentityModel.Tokens;
namespace Project.ViewForm
{
@@ -29,6 +30,7 @@ namespace Project.ViewForm
this.mapctl = new AGVMapControl.MapControl();
this.mapctl.Dock = DockStyle.Fill;
this.mapctl.Visible = true;
this.mapctl.Font = this.panel1.Font;
this.mapctl.BackColor = Color.FromArgb(32, 32, 32);
this.panel1.Controls.Add(mapctl);
}
@@ -39,6 +41,21 @@ namespace Project.ViewForm
ctlAuto1.dev_bms = PUB.BMS;
ctlAuto1.dev_xbe = PUB.XBE;
this.timer1.Start();
PUB.AGV.DataReceive += AGV_DataReceive;
var fn = new System.IO.FileInfo( AR.UTIL.CurrentPath+ "\\sample.route");
if (fn.Exists) this.mapctl.LoadFromFile(fn.FullName);
}
private void AGV_DataReceive(object sender, arDev.Narumi.DataEventArgs e)
{
switch (e.DataType)
{
case arDev.Narumi.DataType.TAG:
var tagno = PUB.AGV.data.TagNo;
this.mapctl.AGVMoveToRFID(tagno.ToString());
break;
}
}
private void CtlAuto1_ButtonClick(CtlAuto.UIButton idx)
@@ -63,6 +80,7 @@ namespace Project.ViewForm
timer1.Stop();
PUB.sm.StepChanged -= Sm_StepChanged;
this.ctlAuto1.ButtonClick -= CtlAuto1_ButtonClick;
PUB.AGV.DataReceive -= AGV_DataReceive;
}
bool tmrun = false;

File diff suppressed because it is too large Load Diff

View File

@@ -1066,17 +1066,18 @@ namespace AGVMapControl
e.Graphics.TranslateTransform(offset.X, offset.Y);
e.Graphics.ScaleTransform(zoom, zoom);
DrawMap(e.Graphics);
DrawCustomLines(e.Graphics);
DrawMapTexts(e.Graphics);
DrawRFIDLines(e.Graphics);
DrawMap(e.Graphics);
//DrawCustomLines(e.Graphics);
DrawMapTexts(e.Graphics);
DrawPath(e.Graphics);
DrawAGV(e.Graphics);
// 선택된 개체 강조 표시
if (selectedRFID != null)
{
using (Pen pen = new Pen(Color.Blue, 2))
using (Pen pen = new Pen(Color.Magenta, 2))
{
pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
e.Graphics.DrawEllipse(pen,
@@ -1088,7 +1089,7 @@ namespace AGVMapControl
if (selectedMagnetLine != null)
{
using (Pen pen = new Pen(Color.Blue, 2))
using (Pen pen = new Pen(Color.Magenta, 2))
{
pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
e.Graphics.DrawLine(pen, selectedMagnetLine.StartPoint, selectedMagnetLine.EndPoint);
@@ -1101,7 +1102,7 @@ namespace AGVMapControl
if (selectedLine != null)
{
using (Pen pen = new Pen(Color.Blue, 2))
using (Pen pen = new Pen(Color.Magenta, 2))
{
pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
e.Graphics.DrawLine(pen, selectedLine.StartPoint, selectedLine.EndPoint);
@@ -1124,8 +1125,6 @@ namespace AGVMapControl
// 툴바 버튼 그리기
foreach (var item in this.toolbarRects)
DrawToolbarButton(e.Graphics, item.Bounds, item.Title, item.isHovering);
}
@@ -1148,13 +1147,22 @@ namespace AGVMapControl
// }
//}
// RFID 포인트 그리기
foreach (var rfid in rfidPoints)
{
var MarkerSize = 5;
g.FillEllipse(Brushes.Green, rfid.Location.X - (MarkerSize/2f), rfid.Location.Y -(MarkerSize/2f), MarkerSize, MarkerSize);
//g.DrawString(rfid.RFIDValue, Font, Brushes.WhiteSmoke, rfid.Location.X + 5, rfid.Location.Y - 5);
}
// RFID 포인트 그리기
foreach (var rfid in rfidPoints)
{
g.FillEllipse(Brushes.Green, rfid.Location.X - 3, rfid.Location.Y - 3, 6, 6);
g.DrawString(rfid.RFIDValue, Font, Brushes.Black, rfid.Location.X + 5, rfid.Location.Y - 5);
//g.FillEllipse(Brushes.Green, rfid.Location.X - 3, rfid.Location.Y - 3, 6, 6);
var fsize = g.MeasureString(rfid.RFIDValue, Font);
g.DrawString(rfid.RFIDValue, Font, Brushes.WhiteSmoke,
(rfid.Location.X - fsize.Width / 2f),
(rfid.Location.Y + 2));
}
//var rfidpts = rfidPoints.Select(t => t.Location).ToArray();
@@ -1238,7 +1246,7 @@ namespace AGVMapControl
{
foreach (var line in rfidLines)
{
using (Pen linePen = new Pen(Color.FromArgb(100, Color.Black), 2))
using (Pen linePen = new Pen(Color.FromArgb(50, Color.Wheat), 2))
{
if (!line.IsBidirectional)
{
@@ -1289,7 +1297,7 @@ namespace AGVMapControl
if (currentPath == null || currentPath.Count < 2)
return;
Color pathColor = Color.FromArgb(180, Color.HotPink);
Color pathColor = Color.FromArgb(100, Color.Lime);
int pathWidth = 10;
using (Pen pathPen = new Pen(pathColor, pathWidth))

View File

@@ -1,46 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{14E8C9A5-013E-49BA-B435-EFEFC77DD623}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>VarData</RootNamespace>
<AssemblyName>VarData</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<PackageReference Include="System.IO.Ports" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<Compile Include="Flag.cs" />
@@ -49,5 +17,4 @@
<Compile Include="Enum.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -1,103 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A16C9667-5241-4313-888E-548375F85D29}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFramework>net8.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>arFrame.Control</RootNamespace>
<AssemblyName>arFrameControl</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<ProjectReference Include="..\arCtl\arControl.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Include="GridView\ColorListItem.cs" />
<Compile Include="MotCommandButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="MotCommandButton.Designer.cs">
<DependentUpon>MotCommandButton.cs</DependentUpon>
</Compile>
<Compile Include="MotionView\MotITem.cs" />
<Compile Include="GridView\GridView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="GridView\GridView.Designer.cs">
<DependentUpon>GridView.cs</DependentUpon>
</Compile>
<Compile Include="MenuBar\MenuControl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="MenuBar\MenuControl.Designer.cs">
<DependentUpon>MenuControl.cs</DependentUpon>
</Compile>
<Compile Include="GridView\GridItem.cs" />
<Compile Include="MenuBar\MenuItem.cs" />
<Compile Include="MotionView\MotionDisplay.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="MotionView\MotionDisplay.Designer.cs">
<DependentUpon>MotionDisplay.cs</DependentUpon>
</Compile>
<Compile Include="MotLinkLabel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="MotLinkLabel.Designer.cs">
<DependentUpon>MotLinkLabel.cs</DependentUpon>
</Compile>
<Compile Include="MotValueNumericUpDown.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="MotValueNumericUpDown.Designer.cs">
<DependentUpon>MotValueNumericUpDown.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\arCtl\arControl.csproj">
<Project>{f31c242c-1b15-4518-9733-48558499fe4b}</Project>
<Name>arControl</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>