1.初始化项目。保险起见bin目录完整提交 2.基于现场代码为调整过的初始项目(此次提交还未解决代码差异问题)

This commit is contained in:
龚记林
2026-08-19 11:14:30 +08:00
parent b820c71956
commit 2b30644d28
382 changed files with 140652 additions and 1 deletions
@@ -0,0 +1,132 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AGVSystem
{
public partial class Agv_Status : Form
{
public Label[] lab_color = new Label[Cls.Param.AGV_Qty];
public Agv_Status()
{
InitializeComponent();
}
private void agv_init(int agv_qty)
{
int qty_temp = agv_qty;
int size =0;
if (panel3.Width >= panel3.Height)
{
size = panel3.Height / Convert.ToInt16(Math.Sqrt(agv_qty));
}
else
{
size = panel3.Width / Convert.ToInt16(Math.Sqrt(agv_qty));
}
if (size > 512) size = 512;
if (size < 21) size = 21;
int count = 0;
for (byte c = 1; c <= Convert.ToInt16(panel3.Height / size); c++)
{
for (byte r = 1; r <= Convert.ToInt16(panel3.Width / size); r++)
{
count++;
Button btn = new Button();
btn.Click += new System.EventHandler(this.btn_info_Click);
btn.Parent = panel3;
btn.Text = count.ToString();
btn.Name = "btn" + count.ToString();
btn.Location = new Point(5 + (r - 1) * size, 5 + (c - 1) * size);
btn.Height = size-5;
btn.Width = size-5;
if (count > Cls.Param.AGV_Qty)
btn.Enabled = false;
else
{
try
{
int id = count;
btn.BackgroundImageLayout = ImageLayout.Zoom;
btn.TextAlign = ContentAlignment.TopLeft;
btn.BackgroundImage = Func.AgvInfo[id - 1].Type == 6? Properties.Resources._6: Properties.Resources._8;
btn.Tag = Func.AgvInfo[id - 1].AssemblyName + "-" + Func.AgvInfo[id - 1].Internal_ID + "号设备";
lab_color[count - 1] = new Label();
lab_color[count - 1].Location = new Point(btn.Location.X + btn.Width - 15, btn.Location.Y + btn.Height - 15);
lab_color[count - 1].Width = 10;
lab_color[count - 1].Height = 10;
lab_color[count - 1].BackColor = Color.Silver;
lab_color[count - 1].Parent = panel3;
btn.SendToBack();
}
catch
{ }
}
}
}
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (Cls.Param.UserName_temp == "")
{
MessageBox.Show("请登录管理员权限!", "AGV调度管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
private void Agv_Status_Load(object sender, EventArgs e)
{
if (Cls.Param.AGV_Qty > 0)
{
agv_init(Cls.Param.AGV_Qty);
}
}
private void btn_info_Click(object sender, EventArgs e)
{
Button btn = (Button)sender;
label13.Text = btn.Text;
comboBox4.SelectedIndex = Func.AgvInfo[Convert.ToInt16(btn.Text) - 1].Run_Status;
num_landmark.Value = Convert.ToDecimal(Func.AgvInfo[Convert.ToInt16(btn.Text)-1].Location_Display);
num_speed.Value = Convert.ToDecimal(Func.AgvInfo[Convert.ToInt16(btn.Text)-1].Run_Speed);
label9.Text = Func.AgvInfo[Convert.ToInt16(btn.Text) - 1].Voltage.ToString();
cmb_bank.SelectedIndex = Func.AgvInfo[Convert.ToInt16(btn.Text) - 1].Bank_Model;
comboBox2.SelectedIndex = Func.AgvInfo[Convert.ToInt16(btn.Text) - 1].Go_Direction;
comboBox5.SelectedIndex = Func.AgvInfo[Convert.ToInt16(btn.Text) - 1].Run_Direction;
num_task.Value = Convert.ToDecimal(Func.AgvInfo[Convert.ToInt16(btn.Text) - 1].Task_ID);
label12.Text = btn.Tag!= null ? btn.Tag.ToString():"";
label14.Text = Func.AgvInfo[Convert.ToInt16(btn.Text) - 1].Warn_info;
button2.BackColor = Func.AgvInfo[Convert.ToInt16(label13.Text) - 1].Enable ? Color.Blue : Color.Yellow;
button2.Text = Func.AgvInfo[Convert.ToInt16(label13.Text) - 1].Enable ? "在线" : "离线";
}
private void button2_Click(object sender, EventArgs e)
{
if (Convert.ToInt16(label13.Text) < 1)
{
return;
}
Func.AgvInfo[Convert.ToInt16(label13.Text) - 1].Enable = !Func.AgvInfo[Convert.ToInt16(label13.Text) - 1].Enable;
string strsql = @"UPDATE [dbo].[AgvInfo]
SET Status = '{1}'
WHERE id = '{0}'";
strsql = string.Format(strsql, Convert.ToInt16(label13.Text), Func.AgvInfo[Convert.ToInt16(label13.Text) - 1].Enable ? 1 : 0);
var n = new ClsDBConn_sql().Command(strsql);
button2.BackColor = Func.AgvInfo[Convert.ToInt16(label13.Text) - 1].Enable ? Color.Blue : Color.Yellow;
button2.Text = Func.AgvInfo[Convert.ToInt16(label13.Text) - 1].Enable ? "在线" : "离线";
}
}
}