태그 자동 추가 하는 작업 중

This commit is contained in:
backuppc
2025-11-14 17:31:00 +09:00
parent 0c2f00e79e
commit 4a992ea9c1
4 changed files with 150 additions and 55 deletions

View File

@@ -32,10 +32,19 @@
this.rtTx = new arCtl.LogTextBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.rtAGV = new arCtl.LogTextBox();
this.rtPLC = new arCtl.LogTextBox();
this.rtBMS = new arCtl.LogTextBox();
this.rtCAL = new arCtl.LogTextBox();
this.rtXbee = new arCtl.LogTextBox();
this.panel1 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.panel4 = new System.Windows.Forms.Panel();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.tableLayoutPanel1.SuspendLayout();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.panel4.SuspendLayout();
this.SuspendLayout();
//
// rtsys
@@ -87,12 +96,12 @@
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel1.Controls.Add(this.rtAGV, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.rtsys, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.rtTx, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.rtPLC, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.rtBMS, 2, 1);
this.tableLayoutPanel1.Controls.Add(this.rtCAL, 3, 1);
this.tableLayoutPanel1.Controls.Add(this.panel1, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.panel2, 3, 1);
this.tableLayoutPanel1.Controls.Add(this.panel3, 2, 1);
this.tableLayoutPanel1.Controls.Add(this.panel4, 0, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
@@ -113,35 +122,15 @@
this.rtAGV.EnableGubunColor = true;
this.rtAGV.Font = new System.Drawing.Font("맑은 고딕", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.rtAGV.ListFormat = "[{0}] {1}";
this.rtAGV.Location = new System.Drawing.Point(3, 349);
this.rtAGV.Location = new System.Drawing.Point(0, 14);
this.rtAGV.MaxListCount = ((ushort)(1000));
this.rtAGV.MaxTextLength = ((uint)(400000u));
this.rtAGV.MessageInterval = 50;
this.rtAGV.Name = "rtAGV";
this.rtAGV.Size = new System.Drawing.Size(164, 143);
this.rtAGV.Size = new System.Drawing.Size(164, 129);
this.rtAGV.TabIndex = 2;
this.rtAGV.Text = "";
//
// rtPLC
//
this.rtPLC.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this.rtPLC.ColorList = new arCtl.sLogMessageColor[0];
this.rtPLC.DateFormat = "mm:ss.fff";
this.rtPLC.DefaultColor = System.Drawing.Color.LightGray;
this.rtPLC.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtPLC.EnableDisplayTimer = false;
this.rtPLC.EnableGubunColor = true;
this.rtPLC.Font = new System.Drawing.Font("맑은 고딕", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.rtPLC.ListFormat = "[{0}] {1}";
this.rtPLC.Location = new System.Drawing.Point(173, 349);
this.rtPLC.MaxListCount = ((ushort)(1000));
this.rtPLC.MaxTextLength = ((uint)(400000u));
this.rtPLC.MessageInterval = 50;
this.rtPLC.Name = "rtPLC";
this.rtPLC.Size = new System.Drawing.Size(164, 143);
this.rtPLC.TabIndex = 2;
this.rtPLC.Text = "";
//
// rtBMS
//
this.rtBMS.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
@@ -153,34 +142,102 @@
this.rtBMS.EnableGubunColor = true;
this.rtBMS.Font = new System.Drawing.Font("맑은 고딕", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.rtBMS.ListFormat = "[{0}] {1}";
this.rtBMS.Location = new System.Drawing.Point(343, 349);
this.rtBMS.Location = new System.Drawing.Point(0, 14);
this.rtBMS.MaxListCount = ((ushort)(1000));
this.rtBMS.MaxTextLength = ((uint)(400000u));
this.rtBMS.MessageInterval = 50;
this.rtBMS.Name = "rtBMS";
this.rtBMS.Size = new System.Drawing.Size(164, 143);
this.rtBMS.Size = new System.Drawing.Size(165, 129);
this.rtBMS.TabIndex = 2;
this.rtBMS.Text = "";
//
// rtCAL
// rtXbee
//
this.rtCAL.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this.rtCAL.ColorList = new arCtl.sLogMessageColor[0];
this.rtCAL.DateFormat = "mm:ss.fff";
this.rtCAL.DefaultColor = System.Drawing.Color.LightGray;
this.rtCAL.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtCAL.EnableDisplayTimer = false;
this.rtCAL.EnableGubunColor = true;
this.rtCAL.Font = new System.Drawing.Font("맑은 고딕", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.rtCAL.ListFormat = "[{0}] {1}";
this.rtCAL.Location = new System.Drawing.Point(513, 349);
this.rtCAL.MaxListCount = ((ushort)(1000));
this.rtCAL.MaxTextLength = ((uint)(400000u));
this.rtCAL.MessageInterval = 50;
this.rtCAL.Name = "rtCAL";
this.rtCAL.Size = new System.Drawing.Size(165, 143);
this.rtCAL.TabIndex = 2;
this.rtCAL.Text = "";
this.rtXbee.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this.rtXbee.ColorList = new arCtl.sLogMessageColor[0];
this.rtXbee.DateFormat = "mm:ss.fff";
this.rtXbee.DefaultColor = System.Drawing.Color.LightGray;
this.rtXbee.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtXbee.EnableDisplayTimer = false;
this.rtXbee.EnableGubunColor = true;
this.rtXbee.Font = new System.Drawing.Font("맑은 고딕", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.rtXbee.ListFormat = "[{0}] {1}";
this.rtXbee.Location = new System.Drawing.Point(0, 14);
this.rtXbee.MaxListCount = ((ushort)(1000));
this.rtXbee.MaxTextLength = ((uint)(400000u));
this.rtXbee.MessageInterval = 50;
this.rtXbee.Name = "rtXbee";
this.rtXbee.Size = new System.Drawing.Size(164, 129);
this.rtXbee.TabIndex = 2;
this.rtXbee.Text = "";
//
// panel1
//
this.panel1.Controls.Add(this.rtXbee);
this.panel1.Controls.Add(this.label1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(173, 349);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(164, 143);
this.panel1.TabIndex = 3;
//
// label1
//
this.label1.Dock = System.Windows.Forms.DockStyle.Top;
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(164, 14);
this.label1.TabIndex = 0;
this.label1.Text = "MC ID";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel2
//
this.panel2.Controls.Add(this.rtBMS);
this.panel2.Controls.Add(this.label3);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(513, 349);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(165, 143);
this.panel2.TabIndex = 4;
//
// panel3
//
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(343, 349);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(164, 143);
this.panel3.TabIndex = 5;
//
// panel4
//
this.panel4.Controls.Add(this.rtAGV);
this.panel4.Controls.Add(this.label2);
this.panel4.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel4.Location = new System.Drawing.Point(3, 349);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(164, 143);
this.panel4.TabIndex = 6;
//
// label2
//
this.label2.Dock = System.Windows.Forms.DockStyle.Top;
this.label2.Location = new System.Drawing.Point(0, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(164, 14);
this.label2.TabIndex = 3;
this.label2.Text = "AGV";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label3
//
this.label3.Dock = System.Windows.Forms.DockStyle.Top;
this.label3.Location = new System.Drawing.Point(0, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(165, 14);
this.label3.TabIndex = 3;
this.label3.Text = "BMS";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// fLog
//
@@ -194,6 +251,9 @@
this.TopMost = true;
this.Load += new System.EventHandler(this.fLog_Load);
this.tableLayoutPanel1.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel4.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -204,8 +264,14 @@
private arCtl.LogTextBox rtTx;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private arCtl.LogTextBox rtAGV;
private arCtl.LogTextBox rtPLC;
private arCtl.LogTextBox rtBMS;
private arCtl.LogTextBox rtCAL;
private arCtl.LogTextBox rtXbee;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
}
}

View File

@@ -29,7 +29,7 @@ namespace Project.Dialog
private void fLog_Load(object sender, EventArgs e)
{
this.label1.Text = $"XBEE:{PUB.setting.XBE_ID}";
var colorlist = new arCtl.sLogMessageColor[]
{
new arCtl.sLogMessageColor("NOR",Color.Black),
@@ -62,7 +62,7 @@ namespace Project.Dialog
}
private void Log_RaiseMsgplc(DateTime LogTime, string TypeStr, string Message)
{
showlog(rtPLC, LogTime, TypeStr, Message);
//showlog(rtPLC, LogTime, TypeStr, Message);
}
private void Log_RaiseMsgbms(DateTime LogTime, string TypeStr, string Message)
{
@@ -70,7 +70,7 @@ namespace Project.Dialog
}
private void Log_RaiseMsgcal(DateTime LogTime, string TypeStr, string Message)
{
showlog(rtCAL, LogTime, TypeStr, Message);
showlog(rtXbee, LogTime, TypeStr, Message);
}
void showlog(arCtl.LogTextBox rtRx, DateTime LogTime, string TypeStr, string Message)
{

View File

@@ -188,14 +188,41 @@ namespace Project
var CurrentNode = PUB._mapNodes.FirstOrDefault(t => t.RfidId.Equals(PUB.Result.LastTAG, StringComparison.OrdinalIgnoreCase));
if (CurrentNode == null)
{
PUB.log.AddE($"RFID:{PUB.Result.LastTAG} 의 노드를 찾을 수 없습니다");
return;
//없는 노드는 자동으로 추가한다
var newNodeId = $"AUTO_{PUB.Result.LastTAG}";
var newNode = new MapNode
{
NodeId = newNodeId,
RfidId = PUB.Result.LastTAG,
Name = $"자동추가_{PUB.Result.LastTAG}",
Type = NodeType.Normal,
Position = new Point(100, 100), // 기본 위치
IsActive = true,
DisplayColor = Color.Orange, // 자동 추가된 노드는 오렌지색으로 표시
CreatedDate = DateTime.Now,
ModifiedDate = DateTime.Now
};
// 맵 노드 리스트에 추가
PUB._mapNodes.Add(newNode);
// 캔버스에 노드 반영 (재설정)
PUB._mapCanvas.Nodes = PUB._mapNodes;
// 로그 기록
PUB.log.AddI($"RFID:{PUB.Result.LastTAG} 노드를 자동 추가했습니다 (NodeId: {newNodeId})");
// CurrentNode에 새로 생성한 노드 할당
CurrentNode = newNode;
}
//모터방향 확인해서 UI와 AGV클래스에 적용한다
var MotDireciton = PUB.AGV.data.Direction == 'B' ? AGVNavigationCore.Models.AgvDirection.Backward : AGVNavigationCore.Models.AgvDirection.Forward;
PUB._virtualAGV.SetPosition(CurrentNode, MotDireciton);
PUB._mapCanvas.SetAGVPosition(PUB.setting.MCID, CurrentNode, MotDireciton);
//태그를 읽었다면 상태를 바로 전송한다
PUB.XBE.SendStatus();
}
break;
case arDev.Narumi.DataType.ACK: