chore: 初始化平芝126KV总装线 WebApi

This commit is contained in:
yexingqiang
2026-06-08 17:19:25 +08:00
commit 437c251f58
126 changed files with 5439 additions and 0 deletions

29
Helpers/Gl.cs Normal file
View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Concurrent;
using WebApi.Models;
namespace WebApi.Helpers
{
/// <summary>
/// 全局变量类
/// </summary>
public class Gl
{
/// <summary>
/// SQL Server连接状态
/// </summary>
public static bool OnLine_Sql { get; set; } = false;
/// <summary>
/// AGV连接状态
/// </summary>
public static bool OnLine_AGV { get; set; } = false;
/// <summary>
/// MQTT连接状态
/// </summary>
public static bool OnLine_MQTT { get; set; } = false;
public static ConcurrentDictionary<string, TightenTool> TightenList { get; set; } = new ConcurrentDictionary<string, TightenTool>();
}
}

147
Helpers/Mqtt.cs Normal file
View File

@@ -0,0 +1,147 @@
using Logger;
using MQTTnet;
using MQTTnet.Client;
using MQTTnet.Extensions.ManagedClient;
using MQTTnet.Server;
using System;
using System.Net.Sockets;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace WebApi.Helpers
{
public class Mqtt
{
public static IMqttClient mqttClient = null;
public static event Action<bool> ConnectionStatusChanged; // 连接状态改变事件
/// <summary>
/// Param1ClientId
/// Param2Topic
/// Param3Message
/// </summary>
public static event Action<string,string,string> MessageReceived; // 接收到消息事件
public static async Task RunMqttStart(string ip,int port,string username, string password)
{
try
{
string clientId = Guid.NewGuid().ToString();
// Create a MQTT client factory
var factory = new MqttFactory();
// Create a MQTT client instance
mqttClient = factory.CreateMqttClient();
// 连接成功
mqttClient.ConnectedAsync += (e =>
{
ConnectionStatusChanged?.Invoke(true);
return Task.CompletedTask;
});
// 连接断开
mqttClient.DisconnectedAsync += (e =>
{
ConnectionStatusChanged?.Invoke(false);
return Task.CompletedTask;
});
// 收到消息
mqttClient.ApplicationMessageReceivedAsync += (e =>
{
string messagePayload = null;
if (e.ApplicationMessage.PayloadSegment.Count > 0)
{
byte[] payload = e.ApplicationMessage.PayloadSegment.Array;
int payloadOffset = e.ApplicationMessage.PayloadSegment.Offset;
int payloadLength = e.ApplicationMessage.PayloadSegment.Count;
messagePayload = Encoding.UTF8.GetString(payload, payloadOffset, payloadLength);
}
else
{
messagePayload = "";
}
MessageReceived?.Invoke(e.ClientId, e.ApplicationMessage.Topic, messagePayload);
return Task.CompletedTask;
});
// Create MQTT client options
var options = new MqttClientOptionsBuilder()
.WithTcpServer(ip, port) // MQTT broker address and port
.WithCredentials(username, password) // Set username and password
.WithClientId(clientId)
.WithCleanSession()
.Build();
// Connect to MQTT broker
var connectResult = await mqttClient.ConnectAsync(options);
}
catch (Exception ex)
{
Log.FunError(ex, MethodBase.GetCurrentMethod().Name);
}
}
/// <summary>
/// 断开连接
/// </summary>
/// <returns></returns>
public static async Task RunMqttStop()
{
if (mqttClient != null)
{
await mqttClient.DisconnectAsync();
mqttClient.Dispose();
mqttClient = null;
}
}
/// <summary>
/// 推送消息
/// </summary>
/// <param name="topic"></param>
/// <param name="message"></param>
/// <returns></returns>
public static async Task RunMqttPublish(string topic, string message)
{
if (mqttClient != null)
{
var publishOptions = new MqttApplicationMessageBuilder()
.WithTopic(topic)
.WithPayload(message)
.WithRetainFlag(false)
.Build();
await mqttClient.PublishAsync(publishOptions);
}
}
/// <summary>
/// 添加订阅
/// </summary>
/// <param name="topic"></param>
/// <returns></returns>
public static async Task RunMqttSubscribe(string topic)
{
if (mqttClient != null)
{
await mqttClient.SubscribeAsync(topic);
}
}
/// <summary>
/// 取消订阅
/// </summary>
/// <param name="topic"></param>
/// <returns></returns>
public static async Task RunMqttUnSubscribe(string topic)
{
if (mqttClient != null)
{
await mqttClient.UnsubscribeAsync(topic);
}
}
}
}

223
Helpers/SqlServer.cs Normal file
View File

@@ -0,0 +1,223 @@
using System;
using System.Data.SqlClient;
using System.Data;
using System.Reflection;
using Logger;
using System.Collections.Generic;
namespace WebApi.Helpers
{
public class SqlServer
{
public static bool ExecuteProcedure(string ProcedureName, SqlParameter[] sqlParameters, out DataTable dt, out string errorMessage)
{
bool result = false;
dt = new DataTable();
errorMessage = "";
using (SqlConnection sqlConnection = new SqlConnection(Tools.AppConfigManage.ReadConfig("ConnectionString")))
{
try
{
sqlConnection.Open();
// 开始事务
SqlTransaction sqlTransaction = sqlConnection.BeginTransaction();
try
{
using (SqlCommand sqlCommand = sqlConnection.CreateCommand())
{
sqlCommand.Transaction = sqlTransaction; // 将事务附加到SqlCommand对象
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlCommand.CommandText = ProcedureName;
if (sqlParameters != null)
{
for (int i = 0; i < sqlParameters.Length; i++)
{
sqlCommand.Parameters.Add(sqlParameters[i]);
}
}
// 创建SqlDataAdapter并关联SqlCommand
using (SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand))
{
// 填充DataTable
sqlDataAdapter.Fill(dt);
}
// 如果执行成功,提交事务
sqlTransaction.Commit();
result = true;
}
}
catch (Exception ex)
{
// 如果执行过程中出现异常,回滚事务
try
{
sqlTransaction.Rollback();
errorMessage = ProcedureName + "存储过程执行失败,事务已回滚。错误信息:" + ex.Message;
Log.Error(ProcedureName + "存储过程执行失败,事务已回滚。错误信息:" + ex.Message);
}
catch (Exception exRollback)
{
// 如果回滚操作也失败,记录回滚异常
errorMessage = ProcedureName + "事务回滚失败。错误信息:" + exRollback.Message;
Log.Error(ProcedureName + "事务回滚失败。错误信息:" + exRollback.Message);
}
finally
{
if (sqlConnection.State == ConnectionState.Open)
{
sqlConnection.Close();
}
}
}
}
catch (Exception ex)
{
errorMessage = ex.Message;
Log.FunError(ex, MethodBase.GetCurrentMethod().Name);
}
finally
{
if (sqlConnection.State == ConnectionState.Open)
{
sqlConnection.Close();
}
}
}
return result;
}
public static bool ExecuteSql(string sql, out DataTable dt, out string errorMessage)
{
bool result = false;
dt = new DataTable();
errorMessage = "";
using (SqlConnection sqlConnection = new SqlConnection(Tools.AppConfigManage.ReadConfig("ConnectionString")))
{
try
{
sqlConnection.Open();
// 开始事务
using (SqlTransaction sqlTransaction = sqlConnection.BeginTransaction())
{
using (SqlCommand sqlCommand = new SqlCommand(sql, sqlConnection, sqlTransaction))
{
sqlCommand.CommandType = CommandType.Text; // 设置为执行文本命令
// 创建SqlDataAdapter并关联SqlCommand
using (SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand))
{
// 填充DataTable
sqlDataAdapter.Fill(dt);
}
// 如果执行成功,提交事务
sqlTransaction.Commit();
result = true;
}
}
}
catch (Exception ex)
{
errorMessage = ex.Message;
Log.FunError(ex, MethodBase.GetCurrentMethod().Name);
}
finally
{
if (sqlConnection.State == ConnectionState.Open)
{
sqlConnection.Close();
}
}
}
return result;
}
public static bool ExecuteProcedure(string ProcedureName, Dictionary<string, Object> sqlParametersDictionary, out DataTable dt, out string errorMessage)
{
// 处理字典数据 转为 SqlParameter
List <SqlParameter> parameterList = new List <SqlParameter> ();
foreach (KeyValuePair<string,Object> param in sqlParametersDictionary)
{
parameterList.Add(new SqlParameter("@" + param.Key, param.Value));
}
SqlParameter[] sqlParameters = parameterList.ToArray();
bool result = false;
dt = new DataTable();
errorMessage = "";
using (SqlConnection sqlConnection = new SqlConnection(Tools.AppConfigManage.ReadConfig("ConnectionString")))
{
try
{
sqlConnection.Open();
// 开始事务
SqlTransaction sqlTransaction = sqlConnection.BeginTransaction();
try
{
using (SqlCommand sqlCommand = sqlConnection.CreateCommand())
{
sqlCommand.Transaction = sqlTransaction; // 将事务附加到SqlCommand对象
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlCommand.CommandText = ProcedureName;
if (sqlParameters != null)
{
for (int i = 0; i < sqlParameters.Length; i++)
{
sqlCommand.Parameters.Add(sqlParameters[i]);
}
}
// 创建SqlDataAdapter并关联SqlCommand
using (SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand))
{
// 填充DataTable
sqlDataAdapter.Fill(dt);
}
// 如果执行成功,提交事务
sqlTransaction.Commit();
result = true;
}
}
catch (Exception ex)
{
// 如果执行过程中出现异常,回滚事务
try
{
sqlTransaction.Rollback();
errorMessage = ProcedureName + "存储过程执行失败,事务已回滚。错误信息:" + ex.Message;
Log.Error(ProcedureName + "存储过程执行失败,事务已回滚。错误信息:" + ex.Message);
}
catch (Exception exRollback)
{
// 如果回滚操作也失败,记录回滚异常
errorMessage = ProcedureName + "事务回滚失败。错误信息:" + exRollback.Message;
Log.Error(ProcedureName + "事务回滚失败。错误信息:" + exRollback.Message);
}
finally
{
if (sqlConnection.State == ConnectionState.Open)
{
sqlConnection.Close();
}
}
}
}
catch (Exception ex)
{
errorMessage = ex.Message;
Log.FunError(ex, MethodBase.GetCurrentMethod().Name);
}
finally
{
if (sqlConnection.State == ConnectionState.Open)
{
sqlConnection.Close();
}
}
}
return result;
}
}
}

301
MainView.Designer.cs generated Normal file
View File

@@ -0,0 +1,301 @@
namespace WebApi
{
partial class MainView
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainView));
this.MessageTable = new AntdUI.Table();
this.divider1 = new AntdUI.Divider();
this.divider2 = new AntdUI.Divider();
this.collapse1 = new AntdUI.Collapse();
this.panel8 = new System.Windows.Forms.Panel();
this.label9 = new System.Windows.Forms.Label();
this.pb_OnLine_Sql = new System.Windows.Forms.PictureBox();
this.panel1 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.pb_OnLine_MQTT = new System.Windows.Forms.PictureBox();
this.panel2 = new System.Windows.Forms.Panel();
this.label2 = new System.Windows.Forms.Label();
this.pb_OnLine_AGV = new System.Windows.Forms.PictureBox();
this.timer_OnLine_Show = new System.Windows.Forms.Timer(this.components);
this.TightenTable = new AntdUI.Table();
this.ClearLog = new AntdUI.Button();
this.logCountLab = new AntdUI.Label();
this.divider3 = new AntdUI.Divider();
this.panel8.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pb_OnLine_Sql)).BeginInit();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pb_OnLine_MQTT)).BeginInit();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pb_OnLine_AGV)).BeginInit();
this.SuspendLayout();
//
// MessageTable
//
this.MessageTable.Location = new System.Drawing.Point(670, 62);
this.MessageTable.Name = "MessageTable";
this.MessageTable.Size = new System.Drawing.Size(884, 796);
this.MessageTable.TabIndex = 0;
this.MessageTable.Text = "table1";
//
// divider1
//
this.divider1.Location = new System.Drawing.Point(781, 170);
this.divider1.Name = "divider1";
this.divider1.Size = new System.Drawing.Size(8, 8);
this.divider1.TabIndex = 1;
this.divider1.Text = "divider1";
//
// divider2
//
this.divider2.Location = new System.Drawing.Point(670, 12);
this.divider2.Name = "divider2";
this.divider2.Size = new System.Drawing.Size(609, 36);
this.divider2.TabIndex = 2;
this.divider2.Text = "日志";
//
// collapse1
//
this.collapse1.Location = new System.Drawing.Point(105, 197);
this.collapse1.Name = "collapse1";
this.collapse1.Size = new System.Drawing.Size(37, 11);
this.collapse1.TabIndex = 3;
this.collapse1.Text = "collapse1";
//
// panel8
//
this.panel8.BackColor = System.Drawing.Color.Gainsboro;
this.panel8.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel8.Controls.Add(this.label9);
this.panel8.Controls.Add(this.pb_OnLine_Sql);
this.panel8.Location = new System.Drawing.Point(37, 41);
this.panel8.Margin = new System.Windows.Forms.Padding(4);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(150, 149);
this.panel8.TabIndex = 1801;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold);
this.label9.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.label9.Location = new System.Drawing.Point(30, 20);
this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(86, 31);
this.label9.TabIndex = 1;
this.label9.Text = "服务器";
//
// pb_OnLine_Sql
//
this.pb_OnLine_Sql.ErrorImage = global::WebApi.Properties.Resources.;
this.pb_OnLine_Sql.Image = global::WebApi.Properties.Resources.;
this.pb_OnLine_Sql.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.pb_OnLine_Sql.Location = new System.Drawing.Point(36, 62);
this.pb_OnLine_Sql.Margin = new System.Windows.Forms.Padding(4);
this.pb_OnLine_Sql.Name = "pb_OnLine_Sql";
this.pb_OnLine_Sql.Size = new System.Drawing.Size(76, 78);
this.pb_OnLine_Sql.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pb_OnLine_Sql.TabIndex = 16;
this.pb_OnLine_Sql.TabStop = false;
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.Gainsboro;
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.pb_OnLine_MQTT);
this.panel1.Location = new System.Drawing.Point(250, 41);
this.panel1.Margin = new System.Windows.Forms.Padding(4);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(150, 149);
this.panel1.TabIndex = 1801;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold);
this.label1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.label1.Location = new System.Drawing.Point(30, 20);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(89, 31);
this.label1.TabIndex = 1;
this.label1.Text = "MQTT";
//
// pb_OnLine_MQTT
//
this.pb_OnLine_MQTT.ErrorImage = global::WebApi.Properties.Resources.;
this.pb_OnLine_MQTT.Image = global::WebApi.Properties.Resources.;
this.pb_OnLine_MQTT.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.pb_OnLine_MQTT.Location = new System.Drawing.Point(36, 62);
this.pb_OnLine_MQTT.Margin = new System.Windows.Forms.Padding(4);
this.pb_OnLine_MQTT.Name = "pb_OnLine_MQTT";
this.pb_OnLine_MQTT.Size = new System.Drawing.Size(76, 78);
this.pb_OnLine_MQTT.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pb_OnLine_MQTT.TabIndex = 16;
this.pb_OnLine_MQTT.TabStop = false;
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Gainsboro;
this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel2.Controls.Add(this.label2);
this.panel2.Controls.Add(this.pb_OnLine_AGV);
this.panel2.Location = new System.Drawing.Point(468, 41);
this.panel2.Margin = new System.Windows.Forms.Padding(4);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(150, 149);
this.panel2.TabIndex = 1801;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold);
this.label2.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.label2.Location = new System.Drawing.Point(40, 20);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(67, 31);
this.label2.TabIndex = 1;
this.label2.Text = "AGV";
//
// pb_OnLine_AGV
//
this.pb_OnLine_AGV.ErrorImage = global::WebApi.Properties.Resources.;
this.pb_OnLine_AGV.Image = global::WebApi.Properties.Resources.;
this.pb_OnLine_AGV.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.pb_OnLine_AGV.Location = new System.Drawing.Point(36, 62);
this.pb_OnLine_AGV.Margin = new System.Windows.Forms.Padding(4);
this.pb_OnLine_AGV.Name = "pb_OnLine_AGV";
this.pb_OnLine_AGV.Size = new System.Drawing.Size(76, 78);
this.pb_OnLine_AGV.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pb_OnLine_AGV.TabIndex = 16;
this.pb_OnLine_AGV.TabStop = false;
//
// timer_OnLine_Show
//
this.timer_OnLine_Show.Enabled = true;
this.timer_OnLine_Show.Interval = 3000;
this.timer_OnLine_Show.Tick += new System.EventHandler(this.timer1_Tick);
//
// TightenTable
//
this.TightenTable.Location = new System.Drawing.Point(12, 436);
this.TightenTable.Name = "TightenTable";
this.TightenTable.Size = new System.Drawing.Size(606, 437);
this.TightenTable.TabIndex = 1802;
this.TightenTable.Text = "IPTable";
//
// ClearLog
//
this.ClearLog.Location = new System.Drawing.Point(1442, 5);
this.ClearLog.Name = "ClearLog";
this.ClearLog.Size = new System.Drawing.Size(136, 57);
this.ClearLog.TabIndex = 1803;
this.ClearLog.Text = "清空日志";
this.ClearLog.Type = AntdUI.TTypeMini.Warn;
this.ClearLog.Click += new System.EventHandler(this.ClearLog_Click);
//
// logCountLab
//
this.logCountLab.BackColor = System.Drawing.SystemColors.AppWorkspace;
this.logCountLab.Font = new System.Drawing.Font("方正舒体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.logCountLab.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.logCountLab.LocalizationSuffix = "条";
this.logCountLab.Location = new System.Drawing.Point(1289, 12);
this.logCountLab.Name = "logCountLab";
this.logCountLab.Size = new System.Drawing.Size(147, 44);
this.logCountLab.TabIndex = 1804;
this.logCountLab.Text = "9999条";
this.logCountLab.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// divider3
//
this.divider3.Location = new System.Drawing.Point(9, 404);
this.divider3.Name = "divider3";
this.divider3.Size = new System.Drawing.Size(609, 36);
this.divider3.TabIndex = 2;
this.divider3.Text = "拧紧扳手";
//
// MainView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1582, 885);
this.Controls.Add(this.logCountLab);
this.Controls.Add(this.ClearLog);
this.Controls.Add(this.TightenTable);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Controls.Add(this.panel8);
this.Controls.Add(this.collapse1);
this.Controls.Add(this.divider3);
this.Controls.Add(this.divider2);
this.Controls.Add(this.divider1);
this.Controls.Add(this.MessageTable);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "MainView";
this.Text = "MESController";
this.panel8.ResumeLayout(false);
this.panel8.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pb_OnLine_Sql)).EndInit();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pb_OnLine_MQTT)).EndInit();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pb_OnLine_AGV)).EndInit();
this.ResumeLayout(false);
}
#endregion
private AntdUI.Table MessageTable;
private AntdUI.Divider divider1;
private AntdUI.Divider divider2;
private AntdUI.Collapse collapse1;
private System.Windows.Forms.Panel panel8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.PictureBox pb_OnLine_Sql;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.PictureBox pb_OnLine_MQTT;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.PictureBox pb_OnLine_AGV;
private System.Windows.Forms.Timer timer_OnLine_Show;
private AntdUI.Table TightenTable;
private AntdUI.Button ClearLog;
private AntdUI.Label logCountLab;
private AntdUI.Divider divider3;
}
}

292
MainView.cs Normal file
View File

@@ -0,0 +1,292 @@
using AntdUI;
using Logger;
using MQTTnet.Server;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net.NetworkInformation;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WebApi.Helpers;
using static WebApi.MainView;
namespace WebApi
{
public partial class MainView : Form
{
InitServer initServer = null;
static BindingList<msgTableClass> msgTableList = new BindingList<msgTableClass>();
static BindingList<tightenTableClass> tightenTableList = new BindingList<tightenTableClass>();
public MainView()
{
InitializeComponent();
InitUI();
AddMessage("程序启动--------------------------");
initServer = new WebApi.InitServer(Convert.ToInt32(Tools.AppConfigManage.ReadConfig("WebApiPort")));
MqttServer.StartMqttServer();
ServerController.ShowMsg += AddMessage;
MqttServer.ShowMsg += AddMessage;
Show_OnLineStateAsync();
Tighten.TightenServer tighten = new Tighten.TightenServer();
Task.Run(() => tighten.InitTightenList());
Tighten.TightenServer.ShowMsg += AddMessage;
Log.ShowMsg += AddMessage;
// 添加关闭程序的二次确认
this.FormClosing += MainView_FormClosing;
}
private void InitUI()
{
MessageTable.Columns = new AntdUI.ColumnCollection {
new AntdUI.Column("dateTime","消息时间"){ Fixed=false,Width="140"},
new AntdUI.Column("msg","消息内容"){ Fixed=false,Width="440",LineBreak=true},
};
MessageTable.Binding(msgTableList);
TightenTable.Columns = new AntdUI.ColumnCollection {
new AntdUI.Column("name","名称"){ Fixed=true},
new AntdUI.Column("ip","IP"){ Fixed=true},
new AntdUI.Column("isConnect","状态",AntdUI.ColumnAlign.Center),
};
TightenTable.Binding(tightenTableList);
}
private void AddMessage(string message)
{
// 如果大于1000条删除最后一条
if (msgTableList.Count > 1000)
{
msgTableList.RemoveAt(msgTableList.Count - 1);
}
msgTableList.Insert(0, new msgTableClass(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), message));
logCountLab.Text = msgTableList.Count.ToString() + "条";
}
public class msgTableClass : AntdUI.NotifyProperty
{
public msgTableClass(string dateTime, string msg)
{
_dateTime = dateTime;
_msg = msg;
}
string _dateTime;
public string dateTime
{ get => _dateTime; set { if (_dateTime == value) return; _dateTime = value; OnPropertyChanged("dateTime"); } }
string _msg;
public string msg
{ get => _msg; set { if (_msg == value) return; _msg = value; OnPropertyChanged("msg"); } }
}
public class tightenTableClass : AntdUI.NotifyProperty
{
public tightenTableClass(string name,string ip, bool isConnect)
{
_name = name;
_ip = ip;
if (isConnect) _isConnect = new AntdUI.CellBadge(AntdUI.TState.Success, "在线");
else _isConnect = new AntdUI.CellBadge(AntdUI.TState.Error, "离线");
}
string _name;
public string name
{ get => _name; set { if (_name == value) return; _name = value; OnPropertyChanged("name"); } }
string _ip;
public string ip
{ get => _ip; set { if (_ip == value) return; _ip = value; OnPropertyChanged("ip"); } }
AntdUI.CellBadge _isConnect;
public AntdUI.CellBadge isConnect
{
get => _isConnect; set { _isConnect = value; OnPropertyChanged("isConnect"); }
}
}
private async void timer1_Tick(object sender, EventArgs e)
{
timer_OnLine_Show.Enabled = false;
await Show_OnLineStateAsync();
RefreshTightenStatus();
timer_OnLine_Show.Enabled = true;
}
private async Task Show_OnLineStateAsync()
{
await OnLineStatus_CheckAsync();
// UI更新需要在主线程执行
this.Invoke((MethodInvoker)delegate
{
OnLineState_C(pb_OnLine_Sql, Gl.OnLine_Sql);
OnLineState_C(pb_OnLine_AGV, Gl.OnLine_AGV);
OnLineState_C(pb_OnLine_MQTT, Gl.OnLine_MQTT);
});
}
/// <summary>
/// 显示通讯状态
/// </summary>
/// <param name="pb"></param>
/// <param name="onLine"></param>
private void OnLineState_C(PictureBox pb, bool onLine)
{
pb.Image = onLine ? global::WebApi.Properties.Resources.
: global::WebApi.Properties.Resources.;
}
public static async Task OnLineStatus_CheckAsync()
{
// 并行检查所有连接状态
var tasks = new List<Task>
{
CheckSqlConnectionAsync(),
CheckAgvConnectionAsync(),
CheckMqttConnectionAsync()
};
await Task.WhenAll(tasks);
}
private static async Task CheckSqlConnectionAsync()
{
try
{
await Task.Run(() =>
{
SqlServer.ExecuteSql("select getdate()", out DataTable dt, out string err);
Gl.OnLine_Sql = string.IsNullOrEmpty(err);
});
}
catch (Exception)
{
Gl.OnLine_Sql = false;
}
}
private static async Task CheckAgvConnectionAsync()
{
try
{
await Task.Run(() =>
{
Gl.OnLine_AGV = Ping(Tools.AppConfigManage.ReadConfig("AGVIP"));
});
}
catch (Exception)
{
Gl.OnLine_AGV = false;
}
}
private static async Task CheckMqttConnectionAsync()
{
try
{
await Task.Run(() =>
{
Gl.OnLine_MQTT = MqttServer.IsConnected();
});
}
catch (Exception)
{
Gl.OnLine_MQTT = false;
}
}
private static bool Ping(string ip)
{
try
{
using (var ping = new Ping())
{
return ping.Send(ip, 1000).Status == IPStatus.Success;
}
}
catch
{
return false;
}
}
private void RefreshTightenStatus()
{
tightenTableList.Clear();
var sortedList = WebApi.Helpers.Gl.TightenList.Values.OrderBy(tool => tool.IP);
foreach (var tool in sortedList)
{
tightenTableList.Add(new tightenTableClass(tool.Name, tool.IP, tool.TcpClient != null && tool.TcpClient.Connected));
}
}
private void ClearLog_Click(object sender, EventArgs e)
{
msgTableList.Clear();
logCountLab.Text = msgTableList.Count.ToString() + "条";
}
/// <summary>
/// 窗体关闭时的确认处理
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MainView_FormClosing(object sender, FormClosingEventArgs e)
{
// 显示确认对话框
DialogResult result = MessageBox.Show(
"确定要关闭程序吗?\n\n关闭程序将停止所有服务WebAPI、MQTT等。",
"关闭确认",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2
);
// 如果用户点击"否",则取消关闭
if (result == DialogResult.No)
{
e.Cancel = true;
AddMessage("用户取消关闭程序");
return;
}
// 用户确认关闭,记录日志并执行清理工作
AddMessage("程序正在关闭...");
try
{
// 停止定时器
if (timer_OnLine_Show != null)
{
timer_OnLine_Show.Stop();
timer_OnLine_Show.Dispose();
}
// 停止MQTT服务器异步方法使用Wait()等待完成)
Task.Run(async () => await MqttServer.StopMqttServer()).Wait();
// 停止WebAPI服务器
if (initServer != null)
{
initServer.Close();
}
AddMessage("程序关闭完成");
}
catch (Exception ex)
{
AddMessage($"关闭程序时发生错误: {ex.Message}");
}
}
}
}

203
MainView.resx Normal file
View File

@@ -0,0 +1,203 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer_OnLine_Show.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>70</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABMLAAATCwAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMgChADIAoQIyAKEgMgChczIA
occyAKHqMgChmTIAoTwyAKEJMgChAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMgChADIAoQQyAKEvMgChdzIA
odYyAKH7MgCh/zIAof8yAKH/MgCh6jIAoacyAKFJMgChEjIAoQAyAKEAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyAKEAMgChADIAoQoyAKE+MgChkTIA
oeoyAKH+MgCh+TIAoe0yAKH+MgCh/zIAofwyAKH3MgCh/jIAofgyAKHBMgChZDIAoR4yAKEBMgChAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyAKEAMgChATIAoRUyAKFcMgChujIA
ofEyAKH/MgCh9DIAobcyAKFPMgChfjIAof8yAKH/MgCh5TIAoVUyAKGLMgCh4jIAofwyAKH9MgCh2TIA
oYcyAKEoMgChBTIAoQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyAKEAMgChAjIAoSYyAKF2MgCh0DIA
ofcyAKH+MgCh8zIAof8yAKGjMgChDTIAoQAyAKFpMgCh/zIAof8yAKHhMgChHjIAoQIyAKEiMgChbjIA
ocoyAKH3MgCh/jIAoeUyAKGfMgChQTIAoQsyAKEAAAAAAAAAAAAAAAAAMgChCDIAoUEyAKGXMgCh4jIA
of4yAKH/MgChzzIAoW0yAKFoMgCh+zIAoZcyAKEAMgChADIAoWkyAKH/MgCh/zIAoeEyAKEeMgChADIA
oQAyAKEBMgChETIAoVAyAKGiMgCh8DIAof8yAKH0MgChuTIAoW0yAKEVMgChADIAoQAyAKG2MgCh7TIA
of8yAKHvMgCh7jIAofgyAKFLMgChADIAoTcyAKH1MgChlzIAoQAyAKEAMgChaTIAof8yAKH/MgCh4TIA
oR4yAKEAAAAAAAAAAAAAAAAAMgChADIAoQcyAKE4MgChijIAod8yAKH9MgCh+zIAoc4yAKFdMgChADIA
of8yAKHlMgChlDIAoToyAKGgMgCh7jIAoSwyAKEAMgChFzIAodgyAKGZMgChADIAoQAyAKFpMgCh/zIA
of8yAKHxMgChfDIAoSkyAKEBMgChAAAAAAAAAAAAAAAAADIAoQAyAKECMgChITIAoW8yAKG/MgCh/zIA
oZYyAKEAMgCh/zIAoZoyAKEBMgChADIAoZkyAKHSMgChEjIAoQAyAKEGMgChujIAoZoyAKEAMgChADIA
oWkyAKH/MgCh/zIAof0yAKH+MgCh4TIAoZIyAKFEMgChDjIAoQAyAKEAAAAAAAAAAAAAAAAAMgChADIA
oUIyAKH7MgChlzIAoQAyAKH/MgChlzIAoQAyAKEAMgChmjIAobMyAKEEMgChADIAoQAyAKGcMgChmzIA
oQAyAKEAMgChaTIAof8yAKH/MgCh4zIAoZYyAKHRMgCh+zIAofQyAKHDMgChZDIAoSIyAKEBMgChAAAA
AAAyAKEAMgChPzIAofsyAKGXMgChADIAof8yAKGXMgChADIAoQAyAKGaMgChiDIAoQAAAAAAMgChADIA
oYgyAKGaMgChADIAoQAyAKFpMgCh/zIAof8yAKHhMgChIDIAoRIyAKFeMgChqzIAoe0yAKH+MgCh3jIA
oYYyAKEqMgChADIAoQAyAKE/MgCh+zIAoZcyAKEAMgCh/zIAoZcyAKEAMgChADIAoZgyAKFtMgChAAAA
AAAyAKEAMgChXDIAoZQyAKEAMgChADIAoWkyAKH/MgCh/zIAoeEyAKEeMgChADIAoQAyAKEGMgChMDIA
oX8yAKHTMgCh+jIAoWkyAKEAMgChADIAoT8yAKH7MgChlzIAoQAyAKH/MgChlzIAoQAyAKEAMgChlTIA
oWMyAKEAAAAAADIAoQAyAKE2MgChhTIAoQAyAKEAMgChaTIAof8yAKH/MgCh4TIAoR4yAKEAAAAAAAAA
AAAyAKEAMgChATIAoRUyAKFYMgChQDIAoQAyAKEAMgChPzIAofsyAKGXMgChADIAof8yAKGXMgChADIA
oQAyAKGLMgChQTIAoQAyAKEFMgChADIAoSMyAKF4MgChADIAoQAyAKFpMgCh/zIAof8yAKHhMgChHjIA
oQAAAAAAAAAAAAAAAAAAAAAAMgChADIAoQAyAKEBMgChADIAoQAyAKE/MgCh+zIAoZcyAKEAMgCh/zIA
oZcyAKEAMgChADIAoXcyAKEkMgChBzIAoUIyAKEBMgChFjIAoWUyAKEBMgChADIAoWkyAKH/MgCh/zIA
oeEyAKEeMgChADIAoQAyAKE5MgChSTIAoQ8yAKEBMgChAAAAAAAAAAAAMgChADIAoT8yAKH7MgChlzIA
oQAyAKH/MgChlzIAoQAyAKECMgChWzIAoQ8yAKEVMgChhTIAoQoyAKEHMgChMzIAoQEyAKEAMgChaTIA
of8yAKH/MgCh4TIAoR4yAKEAMgChADIAoWkyAKH1MgChyzIAoX8yAKE4MgChBTIAoQAyAKEAMgChPzIA
ofsyAKGXMgChADIAof8yAKGXMgChADIAoQMyAKFZMgChCzIAoS4yAKHDMgChGjIAoQAAAAAAAAAAADIA
oQAyAKFpMgCh/zIAof8yAKHhMgChHjIAoQAyAKEAMgChLDIAoaEyAKHkMgCh/DIAoe8yAKGrMgChUzIA
oREyAKFBMgCh+zIAoZcyAKEAMgCh/zIAoZcyAKEAMgChBzIAoVAyAKEEMgChQTIAodoyAKEjMgChAAAA
AAAAAAAAMgChADIAoWkyAKH/MgCh/zIAoeEyAKEeMgChAAAAAAAyAKEAMgChBjIAoSAyAKFyMgChwjIA
ofMyAKH4MgCh0zIAobMyAKH9MgChljIAoQAyAKH/MgChlzIAoQAyAKEBMgChBDIAoQAyAKFKMgCh7jIA
oT0yAKEAAAAAADIAoQAyAKEAMgChbDIAof8yAKH/MgCh4TIAoR8yAKEAAAAAAAAAAAAAAAAAMgChADIA
oQEyAKELMgChRzIAoZYyAKHeMgCh/TIAof8yAKGWMgChADIAof8yAKGXMgChAAAAAAAAAAAAMgChADIA
oW0yAKH/MgChZDIAoQAyAKEEMgChHDIAoWAyAKHPMgCh/zIAof8yAKH3MgChkTIAoS8yAKELMgChADIA
oQAAAAAAAAAAAAAAAAAyAKEAMgChATIAoSAyAKF2MgCh/zIAoZYyAKEAMgCh/zIAoZcyAKEAAAAAADIA
oQAyAKEAMgChljIAof8yAKGeMgChOTIAoZEyAKHcMgCh+TIAof8yAKH/MgCh/zIAof8yAKH+MgCh6jIA
obgyAKFXMgChITIAoQEyAKEAAAAAAAAAAAAAAAAAMgChADIAoT8yAKH7MgChlzIAoQAyAKH/MgChlzIA
oQAAAAAAMgChADIAoQwyAKG9MgCh/zIAofMyAKHyMgCh/jIAof8yAKH/MgCh/zIAofoyAKH3MgCh/jIA
of8yAKH/MgCh/zIAofsyAKHbMgChmzIAoUwyAKENMgChATIAoQAyAKEAMgChPzIAofsyAKGXMgChADIA
of8yAKGXMgChATIAoRkyAKFbMgChsTIAofAyAKH/MgCh/zIAof8yAKH/MgCh/DIAoeYyAKGxMgChVTIA
oUIyAKGFMgCh1TIAofUyAKH/MgCh/zIAof8yAKH/MgCh9DIAocUyAKGDMgChMDIAoQYyAKE/MgCh+zIA
oZcyAKEAMgCh/zIAocEyAKGOMgCh2TIAofcyAKH/MgCh/zIAof8yAKH/MgCh7jIAobMyAKFwMgChJjIA
oQoyAKEAMgChADIAoQEyAKEXMgChTTIAoZsyAKHYMgCh/TIAof8yAKH/MgCh/zIAof4yAKHqMgChszIA
oZgyAKH+MgChljIAoQAyAKH/MgCh/zIAof8yAKH/MgCh/zIAof8yAKH0MgChyTIAoYEyAKE/MgChBzIA
oQAAAAAAMgChADIAoSIyAKF2MgChQjIAoRIyAKEAMgChATIAoR4yAKFjMgChrjIAoecyAKH9MgCh/zIA
of8yAKH/MgCh/zIAof8yAKGWMgChADIAof8yAKH/MgCh/zIAofkyAKHWMgChmjIAoUIyAKERMgChATIA
oQAyAKEGMgChFTIAoQMyAKEAMgChKDIAoZUyAKHHMgChxjIAoXcyAKE3MgChBzIAoQAyAKEGMgChKTIA
oXYyAKHDMgCh7jIAof4yAKH/MgCh/zIAoZYyAKEAMgChrjIAoeYyAKH+MgCh0zIAoVcyAKELMgChADIA
oQAyAKEAMgChADIAoVUyAKHAMgChkjIAoVYyAKEUMgChATIAoRYyAKFhMgChqzIAodUyAKGmMgChZTIA
oR8yAKEDMgChBDIAoS0yAKGiMgCh9DIAofUyAKHGMgChWTIAoQAyAKEGMgChKjIAoWsyAKHBMgCh3DIA
ocEyAKFwMgChJTIAoQYyAKEAMgChDDIAoTgyAKF/MgChyjIAocMyAKGUMgChMzIAoQsyAKEEMgChJjIA
oWUyAKG/MgCh0TIAoaYyAKGoMgCh1TIAodYyAKGNMgChQTIAoRAyAKEAMgChAAAAAAAyAKEAMgChADIA
oQ8yAKE8MgChkDIAoc8yAKHfMgChpDIAoVIyAKEcMgChADIAoQEyAKETMgChRzIAoZ8yAKHGMgChvzIA
oWQyAKEtMgChMzIAoY8yAKHvMgCh5zIAoa8yAKFcMgChHDIAoQMyAKEAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAADIAoQAyAKECMgChFTIAoVcyAKGaMgCh3DIAodEyAKGaMgChSDIAoQsyAKEAMgChATIA
oSUyAKGGMgCh6TIAofEyAKHhMgChtzIAoXAyAKErMgChBTIAoQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMgChADIAoQIyAKElMgChXTIAobgyAKHbMgChxTIA
oYUyAKFbMgChqzIAodEyAKHLMgChhDIAoTsyAKELMgChAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyAKEAMgChCzIA
oTcyAKGTMgCh0zIAofAyAKG2MgChWjIAoRcyAKEBMgChAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA/+Af//+AB//8AAD/8AAAP8AIAA8AGDABARg+AQEYD4ERGAPxMZgAcTOY
ADEzmDAxM5g8MTKIPzEgCDDxIAgwMSB4MAEgeDgBJHg+ATxAD8E8AAHxOAAAMQAAAAEAAwABABwgAQBE
BAEBwAABAEAAA+AAAA/4AAB//wAD///gD/8=
</value>
</data>
</root>

View File

@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebApi.Models
{
/// <summary>
/// AGV发送 到位 离开信号
/// </summary>
public class AGV_To_MES_AgvPass_Req
{
/// <summary>
/// 第三方任务编号,系统唯一不可重复
/// </summary>
public string taskId
{
get;
set;
}
/// <summary>
/// 工位号
/// </summary>
public string station
{
get;
set;
}
/// <summary>
/// 工件编号
/// </summary>
public string EngineNo
{
get;
set;
}
/// <summary>
/// 机型号
/// </summary>
public string SortNo
{
get;
set;
}
/// <summary>
/// 推送类型0到位1离开 当前只推送到位,保留离开推送
/// </summary>
public int type
{
get;
set;
}
}
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebApi.Models
{
/// <summary>
/// 从前端发来的请求发往AGV
/// </summary>
public class MES_To_AGV_From_WEB_Req
{
/// <summary>
/// 请求URL 只携带最后一个单词
/// </summary>
public string url
{
get;
set;
}
/// <summary>
/// 携带的请求参数
/// </summary>
public object data
{
get;
set;
}
}
}

161
Program.cs Normal file
View File

@@ -0,0 +1,161 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using System.IO;
using System.Text;
namespace WebApi
{
internal static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
// 设置全局异常处理
SetupGlobalExceptionHandling();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainView());
}
/// <summary>
/// 设置全局异常处理
/// </summary>
private static void SetupGlobalExceptionHandling()
{
// 设置异常处理模式,让程序继续运行而不是崩溃
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
// 处理UI线程异常
Application.ThreadException += Application_ThreadException;
// 处理非UI线程异常
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
}
/// <summary>
/// 处理UI线程异常
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
try
{
string errorMessage = GetExceptionDetails(e.Exception);
// 记录异常日志
LogException(errorMessage, "UI线程异常");
// 显示友好的错误提示
MessageBox.Show(
$"程序遇到错误,但已自动处理,程序将继续运行。\n\n错误信息{e.Exception.Message}\n\n详细信息已记录到日志文件中。",
"程序错误",
MessageBoxButtons.OK,
MessageBoxIcon.Warning
);
}
catch (Exception ex)
{
// 如果异常处理本身出错,至少尝试显示基本信息
MessageBox.Show($"程序遇到严重错误:{ex.Message}", "严重错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
/// <summary>
/// 处理非UI线程异常
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
try
{
Exception exception = e.ExceptionObject as Exception;
if (exception != null)
{
string errorMessage = GetExceptionDetails(exception);
// 记录异常日志
LogException(errorMessage, "非UI线程异常");
// 如果是终止性异常,显示更严重的提示
if (e.IsTerminating)
{
MessageBox.Show(
$"程序遇到严重错误,可能需要重启。\n\n错误信息{exception.Message}\n\n详细信息已记录到日志文件中。",
"严重错误",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
}
}
}
catch (Exception ex)
{
// 最后的保险措施
MessageBox.Show($"程序遇到无法处理的错误:{ex.Message}", "致命错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
/// <summary>
/// 获取异常详细信息
/// </summary>
/// <param name="exception"></param>
/// <returns></returns>
private static string GetExceptionDetails(Exception exception)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine($"异常时间:{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
sb.AppendLine($"异常类型:{exception.GetType().Name}");
sb.AppendLine($"异常消息:{exception.Message}");
sb.AppendLine($"异常堆栈:{exception.StackTrace}");
if (exception.InnerException != null)
{
sb.AppendLine("内部异常:");
sb.AppendLine(GetExceptionDetails(exception.InnerException));
}
return sb.ToString();
}
/// <summary>
/// 记录异常日志
/// </summary>
/// <param name="errorMessage"></param>
/// <param name="exceptionType"></param>
private static void LogException(string errorMessage, string exceptionType)
{
try
{
string logDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs");
if (!Directory.Exists(logDir))
{
Directory.CreateDirectory(logDir);
}
string logFile = Path.Combine(logDir, $"Exception_{DateTime.Now:yyyy-MM-dd}.log");
StringBuilder logContent = new StringBuilder();
logContent.AppendLine($"==================== {exceptionType} ====================");
logContent.AppendLine(errorMessage);
logContent.AppendLine(new string('=', 50));
logContent.AppendLine();
File.AppendAllText(logFile, logContent.ToString(), Encoding.UTF8);
}
catch
{
// 如果日志记录失败,也不要抛出异常
}
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("WebApi")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebApi")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("64dfb865-859c-478b-96c6-ab52dcb1de92")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

873
Properties/Resources.Designer.cs generated Normal file
View File

@@ -0,0 +1,873 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebApi.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WebApi.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _002_列表 {
get {
object obj = ResourceManager.GetObject("002_列表", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _0780fca3def52d8a02649c7aa2f8093a {
get {
object obj = ResourceManager.GetObject("0780fca3def52d8a02649c7aa2f8093a", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap action_Cancel_16xLG {
get {
object obj = ResourceManager.GetObject("action_Cancel_16xLG", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap BOSS_数据管理 {
get {
object obj = ResourceManager.GetObject("BOSS-数据管理", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap HMI {
get {
object obj = ResourceManager.GetObject("HMI", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap JD {
get {
object obj = ResourceManager.GetObject("JD", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap MBE风格多色图标_密码 {
get {
object obj = ResourceManager.GetObject("MBE风格多色图标-密码", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap panlClose {
get {
object obj = ResourceManager.GetObject("panlClose", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap ssbj {
get {
object obj = ResourceManager.GetObject("ssbj", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap staticjd {
get {
object obj = ResourceManager.GetObject("staticjd", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("上传", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("上载", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("下载", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("业务", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("任务监控和查询", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("保存", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _记录 {
get {
object obj = ResourceManager.GetObject("信息_记录", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("关闭", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("关闭系统", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("写入托盘", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("分布图", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("列表", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap 2 {
get {
object obj = ResourceManager.GetObject("列表2", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("删除", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("刷新", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("动态数据查询", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("合作", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _柱 {
get {
object obj = ResourceManager.GetObject("图表_柱", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _线_通用_统计 {
get {
object obj = ResourceManager.GetObject("图表_线_通用_统计", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _饼 {
get {
object obj = ResourceManager.GetObject("图表_饼", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("增加", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _复制 {
get {
object obj = ResourceManager.GetObject("备份_复制", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _盖章 {
get {
object obj = ResourceManager.GetObject("审核_盖章", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("密码", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("导入", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("导出", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("工作台", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("工具", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("布局图", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("帮助", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _危险 {
get {
object obj = ResourceManager.GetObject("异常_危险", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("手动打印", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("打印机", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap 线 {
get {
object obj = ResourceManager.GetObject("按键分割线", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap 线 {
get {
object obj = ResourceManager.GetObject("按键分割线浅", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("搜索", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("操作管理", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("文档", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("断开", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("断开状态", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("断开连接", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _添加 {
get {
object obj = ResourceManager.GetObject("新增_添加", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("日志", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("更多", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("权限角色管理", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _成功 {
get {
object obj = ResourceManager.GetObject("正确_成功", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("添加", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _账号_我的 {
get {
object obj = ResourceManager.GetObject("用户_账号_我的", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _账号_我的_未登录 {
get {
object obj = ResourceManager.GetObject("用户_账号_我的_未登录", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap 2 {
get {
object obj = ResourceManager.GetObject("登出2", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("登录", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("筛选", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("系统管理", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("系统管理和监控服务", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _角色 {
get {
object obj = ResourceManager.GetObject("组群_角色", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _修改 {
get {
object obj = ResourceManager.GetObject("编辑_修改", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("解锁", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap 2 {
get {
object obj = ResourceManager.GetObject("记录2", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("质控管理", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _协助 {
get {
object obj = ResourceManager.GetObject("辅助_协助", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap 2 {
get {
object obj = ResourceManager.GetObject("返回2", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _沙漏 {
get {
object obj = ResourceManager.GetObject("进度_沙漏", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("连接", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("连接状态", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap 退 {
get {
object obj = ResourceManager.GetObject("退出", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("配置", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap 2 {
get {
object obj = ResourceManager.GetObject("配置2", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("重新加载数据", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("锁定", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _失败 {
get {
object obj = ResourceManager.GetObject("错误_失败", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("零件管理", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

364
Properties/Resources.resx Normal file
View File

@@ -0,0 +1,364 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="002_列表" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\002_列表.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="0780fca3def52d8a02649c7aa2f8093a" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\0780fca3def52d8a02649c7aa2f8093a.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="action_Cancel_16xLG" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\action_Cancel_16xLG.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="BOSS-数据管理" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\BOSS-数据管理.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="HMI" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\HMI.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="JD" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\JD.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="MBE风格多色图标-密码" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\MBE风格多色图标-密码.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="panlClose" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\panlClose.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ssbj" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\ssbj.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="staticjd" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\staticjd.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="按键分割线" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\按键分割线.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="按键分割线浅" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\按键分割线浅.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="帮助" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\帮助.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="保存" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\保存.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="备份_复制" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\备份_复制.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="编辑_修改" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\编辑_修改.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="布局图" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\布局图.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="操作管理" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\操作管理.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="错误_失败" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\错误_失败.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="打印机" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\打印机.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="导出" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\导出.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="导入" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\导入.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="登出2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\登出2.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="登录" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\登录.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="动态数据查询" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\动态数据查询.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="断开" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\断开.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="断开连接" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\断开连接.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="断开状态" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\断开状态.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="返回2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\返回2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="分布图" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\分布图.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="辅助_协助" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\辅助_协助.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="更多" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\更多.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="工具" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\工具.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="工作台" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\工作台.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="关闭" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\关闭.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="关闭系统" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\关闭系统.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="合作" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\合作.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="记录2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\记录2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="解锁" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\解锁.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="进度_沙漏" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\进度_沙漏.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="连接" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\连接.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="连接状态" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\连接状态.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="列表" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\列表.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="列表2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\列表2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="零件管理" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\零件管理.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="密码" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\密码.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="配置" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\配置.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="配置2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\配置2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="权限角色管理" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\权限角色管理.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="任务监控和查询" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\任务监控和查询.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="日志" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\日志.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="筛选" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\筛选.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="删除" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\删除.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="上传" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\上传.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="上载" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\上载.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="审核_盖章" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\审核_盖章.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="手动打印" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\手动打印.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="刷新" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\刷新.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="搜索" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\搜索.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="锁定" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\锁定.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="添加" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\添加.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="图表_饼" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\图表_饼.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="图表_线_通用_统计" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\图表_线_通用_统计.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="图表_柱" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\图表_柱.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="退出" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\退出.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="文档" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\文档.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="系统管理" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\系统管理.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="系统管理和监控服务" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\系统管理和监控服务.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="下载" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\下载.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="写入托盘" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\写入托盘.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="新增_添加" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\新增_添加.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="信息_记录" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\信息_记录.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="业务" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\业务.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="异常_危险" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\异常_危险.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="用户_账号_我的" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\用户_账号_我的.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="用户_账号_我的_未登录" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\用户_账号_我的_未登录.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="增加" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\增加.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="正确_成功" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\正确_成功.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="质控管理" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\质控管理.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="重新加载数据" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\重新加载数据.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="组群_角色" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\icon\组群_角色.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

30
Properties/Settings.Designer.cs generated Normal file
View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebApi.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

215
Server/MqttServer.cs Normal file
View File

@@ -0,0 +1,215 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebApi.Helpers;
using Logger;
using System.Reflection;
using System.Threading;
namespace WebApi
{
public class MqttServer
{
private static string mqttTopic;
private static string mqttIp;
private static int mqttPort;
private static bool isConnected = false;
private static bool isReconnecting = false;
private static CancellationTokenSource reconnectCancellation;
public static event Action<string> ShowMsg; // 记录日志事件
public static async Task StartMqttServer()
{
try
{
reconnectCancellation = new CancellationTokenSource();
// 从配置文件读取MQTT配置
string mqttConfig = Tools.AppConfigManage.ReadConfig("mqttIp");
if (!string.IsNullOrEmpty(mqttConfig))
{
var parts = mqttConfig.Split(',');
if (parts.Length == 2)
{
mqttIp = parts[0];
mqttPort = Convert.ToInt32(parts[1]);
}
}
mqttTopic = Tools.AppConfigManage.ReadConfig("mqttTopic");
// 注册MQTT事件处理
Mqtt.ConnectionStatusChanged += OnMqttConnectionStatusChanged;
//Mqtt.MessageReceived += OnMqttMessageReceived;
await ConnectToMqttServer();
}
catch (Exception ex)
{
Log.FunError(ex, MethodBase.GetCurrentMethod().Name);
// 如果首次连接失败,也启动重连
await StartReconnection();
}
}
private static async Task ConnectToMqttServer()
{
try
{
// 连接MQTT服务器
await Mqtt.RunMqttStart(mqttIp, mqttPort, "", "");
// 订阅主题
if (!string.IsNullOrEmpty(mqttTopic))
{
await Mqtt.RunMqttSubscribe(mqttTopic);
}
}
catch (Exception ex)
{
Log.FunError(ex, MethodBase.GetCurrentMethod().Name);
throw;
}
}
private static async Task StartReconnection()
{
if (isReconnecting) return;
try
{
isReconnecting = true;
int retryCount = 0;
int maxRetryInterval = 10; // 最大重试间隔(秒)
while (!isConnected && !reconnectCancellation.Token.IsCancellationRequested)
{
try
{
retryCount++;
// 计算重试间隔(指数退避),但不超过最大间隔
double delaySeconds = Math.Min(Math.Pow(2, retryCount - 1), maxRetryInterval);
ShowMsg?.Invoke($"MQTT准备重连{delaySeconds}秒后重试...");
await Task.Delay(TimeSpan.FromSeconds(delaySeconds), reconnectCancellation.Token);
await ConnectToMqttServer();
}
catch (Exception ex)
{
Log.FunError(ex, "MQTT重连失败");
}
}
}
finally
{
isReconnecting = false;
}
}
private static void OnMqttConnectionStatusChanged(bool connected)
{
isConnected = connected;
if (connected)
{
ShowMsg?.Invoke($"MQTT已连接到服务器 {mqttIp}:{mqttPort}");
}
else
{
ShowMsg?.Invoke($"MQTT已断开连接");
// 启动重连
Task.Run(StartReconnection);
}
}
private static void OnMqttMessageReceived(string clientId, string topic, string message)
{
try
{
ShowMsg?.Invoke($"收到MQTT消息: Topic={topic}, Message={message}");
// 这里可以添加消息处理逻辑
if (topic == mqttTopic)
{
// 处理特定主题的消息
}
}
catch (Exception ex)
{
Log.FunError(ex, MethodBase.GetCurrentMethod().Name);
}
}
public static async Task StopMqttServer()
{
try
{
// 停止重连
if (reconnectCancellation != null)
{
reconnectCancellation.Cancel();
reconnectCancellation.Dispose();
reconnectCancellation = null;
}
// 取消订阅
if (!string.IsNullOrEmpty(mqttTopic))
{
await Mqtt.RunMqttUnSubscribe(mqttTopic);
}
// 断开连接
await Mqtt.RunMqttStop();
// 取消事件注册
Mqtt.ConnectionStatusChanged -= OnMqttConnectionStatusChanged;
//Mqtt.MessageReceived -= OnMqttMessageReceived;
}
catch (Exception ex)
{
Log.FunError(ex, MethodBase.GetCurrentMethod().Name);
}
}
public static bool IsConnected()
{
return isConnected;
}
/// <summary>
/// 发送MQTT消息
/// </summary>
/// <param name="message">要发送的消息内容到工位</param>
/// <returns></returns>
public static async Task<bool> SendMqttMessageToOp(string opName, string type, string value)
{
try
{
if (!MqttServer.IsConnected())
{
ShowMsg?.Invoke("MQTT未连接无法发送消息");
return false;
}
string mqttTopic = Tools.AppConfigManage.ReadConfig("mqttTopic");
if (string.IsNullOrEmpty(mqttTopic))
{
ShowMsg?.Invoke("MQTT主题未配置");
return false;
}
string sendMsg = $"MES|{type}|{opName}|{value}";
// MES/InstantMessaging/PZ126/OP010
// MES|AGVStatus|OP010|1
await Mqtt.RunMqttPublish(mqttTopic + opName, sendMsg);
ShowMsg?.Invoke($"MQTTSend: Topic={mqttTopic}, Message={sendMsg}");
return true;
}
catch (Exception ex)
{
Log.FunError(ex, MethodBase.GetCurrentMethod().Name);
return false;
}
}
}
}

View File

@@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace WebApi.Tighten
{
public class TightenHelpers
{
public static bool Send(TcpClient tcpClient, string command,out string errMsg)
{
bool send = false;
errMsg = "";
try
{
var sendstr = command.Replace(" ", "");
byte[] commandbyte = Encoding.Default.GetBytes(sendstr);
tcpClient.Client.Send(commandbyte, SocketFlags.None);
send = true;
}
catch (Exception err)
{
errMsg = err.Message;
send = false;
}
return send;
}
public static string Read(TcpClient tcpClient, out string errMsg)
{
errMsg = "";
string command = "";
if (tcpClient != null && tcpClient.Connected)
{
try
{
byte[] byteCommand = new byte[1024];
int icommand = tcpClient.Client.Receive(byteCommand);
command = System.Text.Encoding.ASCII.GetString(byteCommand, 0, icommand);
}
catch(Exception ex) {
errMsg = ex.Message;
}
}
return command;
}
public static void ParseTorqueData(string input, out double minTorque, out double maxTorque, out double targetTorque, out double actualTorque)
{
// 初始化默认值
minTorque = maxTorque = targetTorque = actualTorque = 0;
// 检查输入长度是否足够至少需要146字符
if (input == null || input.Length < 146)
{
throw new ArgumentException("输入字符串长度不足");
}
// 解析扭矩最小值字节117-122索引116-121
string torqueMinStr = input.Substring(116, 6);
if (int.TryParse(torqueMinStr, out int torqueMinInt))
minTorque = torqueMinInt / 100.0;
// 解析扭矩最大值字节125-130索引124-129
string torqueMaxStr = input.Substring(124, 6);
if (int.TryParse(torqueMaxStr, out int torqueMaxInt))
maxTorque = torqueMaxInt / 100.0;
// 解析扭矩目标值字节133-138索引132-137
string torqueTargetStr = input.Substring(132, 6);
if (int.TryParse(torqueTargetStr, out int torqueTargetInt))
targetTorque = torqueTargetInt / 100.0;
// 解析实际扭矩值字节141-146索引140-145
string torqueActualStr = input.Substring(140, 6);
if (int.TryParse(torqueActualStr, out int torqueActualInt))
actualTorque = torqueActualInt / 100.0;
}
}
}

View File

@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace WebApi.Models
{
public class TightenTool
{
public readonly object TcpClientLock = new object();
/// <summary>
/// 工位号
/// </summary>
public string OpName
{
get;
set;
}
/// <summary>
/// 拧紧枪名称
/// </summary>
public string Name
{
get;
set;
}
/// <summary>
/// IP
/// </summary>
public string IP
{
get;
set;
}
/// <summary>
/// 端口号
/// </summary>
public string Port
{
get;
set;
}
/// <summary>
/// TPC客户端
/// </summary>
public TcpClient TcpClient
{
get;
set;
}
/// <summary>
/// 安全判断TcpClient是否已连接
/// </summary>
public bool IsConnected
{
get { return TcpClient != null && TcpClient.Connected; }
}
}
}

256
Tighten/TightenServer.cs Normal file
View File

@@ -0,0 +1,256 @@
using Logger;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net.Http;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.Remoting.Contexts;
using System.Security.Cryptography;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using WebApi.Helpers;
using WebApi.Models;
namespace WebApi.Tighten
{
public class TightenServer
{
Dictionary<string,string> SendCode = new Dictionary<string,string>
{
{ "connect", "0020 0001 0050 0001 0000" }, // 建立通讯
{ "heart", "00209999001000010000" }, // 心跳
{ "curve", "00200900000000000000" }, // 曲线
{ "result", "00200060001000010000" }, // 订阅结果
{ "tightenOk", "00200062001000000000" } // 确认收到结果
};
public static event Action<string> ShowMsg; // 记录日志事件
private bool _heartbeatRunning = false;
public void InitTightenList()
{
RedTightenList();
//Connect();
StartHeartbeatLoop();
StartReadData();
}
public void Connect()
{
try
{
foreach (KeyValuePair<string, TightenTool> kvp in Gl.TightenList)
{
if (!kvp.Value.IsConnected)
{
kvp.Value.TcpClient.Connect(kvp.Value.IP, Convert.ToInt32(kvp.Value.Port));
if (kvp.Value.IsConnected)
{
string ErrMsg;
// 创建工具连接
if (!TightenHelpers.Send(kvp.Value.TcpClient, SendCode["connect"], out ErrMsg))
{
Log.Error(kvp.Value.IP + "" + ErrMsg);
return;
}
// 心跳
if (!TightenHelpers.Send(kvp.Value.TcpClient, SendCode["heart"], out ErrMsg))
{
Log.Error(kvp.Value.IP + "" + ErrMsg);
return;
}
// 订阅结果
if (!TightenHelpers.Send(kvp.Value.TcpClient, SendCode["result"], out ErrMsg))
{
Log.Error(kvp.Value.IP + "" + ErrMsg);
return;
}
}
}
}
}
catch (Exception ex) {
Log.FunError(ex, MethodBase.GetCurrentMethod().Name);
}
}
private void RedTightenList()
{
SqlServer.ExecuteSql("SELECT * FROM PTCHV_基础表_拧紧枪", out DataTable dt, out string err);
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows) {
var tool = new TightenTool();
tool.OpName = dr["OpName"].ToString();
tool.Name = dr["Name"].ToString();
tool.IP = dr["IP"].ToString();
tool.Port = dr["Port"].ToString();
tool.TcpClient = new System.Net.Sockets.TcpClient();
Gl.TightenList.TryAdd(tool.IP, tool);
}
}
}
private bool SaveTightenData(string opName,string toolName,string max,string min,string OkValue,string value)
{
bool isOk = false;
var param = new Dictionary<string, Object>{
{ "工位号", opName },
{ "拧紧枪名称", toolName },
{ "上限值", max },
{ "下限值", min },
{ "标准值", OkValue },
{ "值", value }
};
SqlServer.ExecuteProcedure("PTCHV_质量数据_增加", param, out DataTable dt, out string err);
if (dt.Rows.Count > 0)
{
if(dt.Rows[0]["result"].ToString() == "1")
{
isOk = true;
}
}
return isOk;
}
// 开启心跳轮询 同时监听数据
public void StartHeartbeatLoop()
{
foreach (var kvp in Gl.TightenList)
{
var tool = kvp.Value;
Task.Run(async () =>
{
while (true)
{
try
{
if (tool.TcpClient == null)
tool.TcpClient = new TcpClient();
if (!tool.IsConnected)
{
try
{
tool.TcpClient.Close();
}
catch { }
tool.TcpClient = new TcpClient();
// 连接加超时
var connectTask = tool.TcpClient.ConnectAsync(tool.IP, Convert.ToInt32(tool.Port));
if (await Task.WhenAny(connectTask, Task.Delay(3000)) == connectTask)
{
// 连接成功
string errMsg;
TightenHelpers.Send(tool.TcpClient, SendCode["connect"], out errMsg);
TightenHelpers.Send(tool.TcpClient, SendCode["heart"], out errMsg);
TightenHelpers.Send(tool.TcpClient, SendCode["result"], out errMsg);
if(errMsg == "")
{
Log.Info($"拧紧枪【{tool.Name}】 连接成功!");
}
}
else
{
//Log.Error($"{tool.IP} 连接超时");
}
}
else
{
string errMsg;
TightenHelpers.Send(tool.TcpClient, SendCode["heart"], out errMsg);
}
}
catch (Exception ex)
{
Log.FunError(ex, "HeartbeatLoop");
}
await Task.Delay(10000);
}
});
}
}
public void StartReadData()
{
foreach (var kvp in Gl.TightenList)
{
Task.Run(async () =>
{
while (true)
{
var tool = kvp.Value;
string ErrMsg = "";
try
{
var client = tool.TcpClient;
bool isConnected = false;
try
{
isConnected = client?.Client?.Connected ?? false;
}
catch (ObjectDisposedException)
{
isConnected = false;
}
catch (Exception ex)
{
Log.Error($"检查连接状态时发生意外错误 for {tool.IP}: {ex.Message}");
isConnected = false;
}
if (isConnected)
{
string command = "";
try
{
if(client != null)
command = TightenHelpers.Read(client, out ErrMsg);
else
continue;
if(ErrMsg != "")
{
Log.Error("【ReadErr】"+kvp.Value.IP + "" + ErrMsg);
}
if (command.Length == 232)
{
TightenHelpers.ParseTorqueData(command, out double min, out double max, out double target, out double actual);
ShowMsg?.Invoke($"【{tool.OpName}{tool.Name} 拧紧数据】最小扭矩: {min}, 最大扭矩: {max}, 目标扭矩: {target}, 实际扭矩: {actual}");
SaveTightenData(tool.OpName, tool.Name, max.ToString(), min.ToString(), target.ToString(), actual.ToString());
await MqttServer.SendMqttMessageToOp(tool.OpName, "TightenOk", "1");
// 发送确认前再次检查连接状态
bool canSend = false;
try
{
canSend = client?.Client?.Connected ?? false;
} catch { /* ignore */ }
if (canSend)
{
TightenHelpers.Send(client, SendCode["tightenOk"], out ErrMsg);
}
}
}
catch (Exception readSendEx) // 捕获读取或发送过程中的异常
{
Log.Error($"读取或发送数据时出错 for {tool.IP}: {readSendEx.Message}");
try { client?.Close(); } catch { }
tool.TcpClient = null; // 标记以便下次循环重建
}
}
} catch (Exception outerEx) {
Log.FunError(outerEx, MethodBase.GetCurrentMethod().Name);
}
await Task.Delay(50);
}
});
}
}
}
}

BIN
TightenSetting.xlsx Normal file

Binary file not shown.

113
Tools/AppConfigManage.cs Normal file
View File

@@ -0,0 +1,113 @@
using Logger;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Configuration;
using System.Xml;
namespace Tools
{
public class AppConfigManage
{
public static Dictionary<string, string> ReadConfigList()
{
Dictionary<string, string> appSettingsDictionary = new Dictionary<string, string>();
var appSettings = ConfigurationManager.AppSettings;
foreach (var key in appSettings.AllKeys)
{
appSettingsDictionary.Add(key, appSettings[key]);
}
return appSettingsDictionary;
}
public static string ReadConfig(string key)
{
return ConfigurationManager.AppSettings[key];
}
public static void DeleteConfig(string key)
{
// 获取配置文件路径
string configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).FilePath;
Configuration config = ConfigurationManager.OpenExeConfiguration(configFile);
// 加载xml文件
XmlDocument xDoc = new XmlDocument();
xDoc.Load(configFile);
// 获取appSettings节点
XmlNode xNode = xDoc.SelectSingleNode("//appSettings");
if (xNode != null)
{
// 查找并删除指定的节点
XmlNode toRemove = xNode.SelectSingleNode($"add[@key='{key}']");
if (toRemove != null)
{
xNode.RemoveChild(toRemove);
config.AppSettings.Settings.Remove(key);
}
}
// 保存xml文档
xDoc.Save(configFile);
// 保存配置文件
config.Save(ConfigurationSaveMode.Modified);
// 刷新配置节以便ConfigurationManager使用最新的配置
ConfigurationManager.RefreshSection("appSettings");
}
public static void SaveConfig(string key, string value)
{
try
{
// 获取配置文件路径
string configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).FilePath;
Configuration config = ConfigurationManager.OpenExeConfiguration(configFile);
KeyValueConfigurationElement setting = config.AppSettings.Settings[key];
XmlDocument xDoc = new XmlDocument();
xDoc.Load(configFile);//加载xml文件
XmlNode xNode;
XmlElement xElem1;
XmlElement xElem2;
xNode = xDoc.SelectSingleNode("//appSettings");//获取指定的xml子节点
xElem1 = (XmlElement)xNode.SelectSingleNode($"//add[@key='{key}']");//获取子节点中指定的子节点
//如果能获取到节点就修改节点的value值
if (xElem1 != null)
{
xElem1.SetAttribute("value", value);//给节点中的value属性赋值(修改操作)
}
//如果不能获取到节点,就创建节点
else
{
xElem2 = xDoc.CreateElement("add");
xElem2.SetAttribute("key", key);
xElem2.SetAttribute("value", value);
xNode.AppendChild(xElem2);
}
if (setting != null)
{
setting.Value = value;
}
else
{
config.AppSettings.Settings.Add(key, value);
}
xDoc.Save(configFile);//保存xml文档
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
}
catch (Exception ex)
{
Log.FunError(ex, MethodBase.GetCurrentMethod().Name);
}
}
}
}

96
Tools/Logger.cs Normal file
View File

@@ -0,0 +1,96 @@
using Serilog;
using Serilog.Events;
using Serilog.Formatting;
using System;
using System.IO;
using System.Security.Policy;
namespace Logger
{
public static class Log
{
private static readonly ILogger logger;
public static event Action<string> ShowMsg; // 记录日志事件
static Log()
{
string logpath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"Logs\Log_{DateTime.Now:yyyy-MM-dd}.html");
logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.File(new HtmlFormatter(), logpath,
rollingInterval: RollingInterval.Day,
rollOnFileSizeLimit: true,
retainedFileCountLimit: 7,
fileSizeLimitBytes: 1000 * 1024)
.CreateLogger();
}
public static void Error(string message)
{
ShowMsg?.Invoke(message);
logger.Error(message);
}
public static void FunError(Exception ex, string funName)
{
ShowMsg?.Invoke(funName + " — FunErr — " + ex.Message);
logger.Error(funName + " — FunErr — " + ex.Message);
}
public static void Info(string message)
{
ShowMsg?.Invoke(message);
logger.Information(message);
}
public static void Debug(string message)
{
ShowMsg?.Invoke(message);
logger.Debug(message);
}
public static void Warning(string message)
{
ShowMsg?.Invoke(message);
logger.Warning(message);
}
public static void Fatal(string message)
{
ShowMsg?.Invoke(message);
logger.Fatal(message);
}
}
public class HtmlFormatter : ITextFormatter
{
public void Format(LogEvent logEvent, TextWriter output)
{
string levelColor = GetLevelColor(logEvent.Level);
string message = logEvent.RenderMessage();
output.WriteLine($"<div style=\"color: {levelColor};\">");
output.WriteLine($"<p>[{logEvent.Timestamp:yyyy-MM-dd HH:mm:ss}] [{logEvent.Level}] {message}</p>");
output.WriteLine("</div>");
}
private string GetLevelColor(LogEventLevel level)
{
switch (level)
{
case LogEventLevel.Debug:
return "gray";
case LogEventLevel.Information:
return "black";
case LogEventLevel.Warning:
return "orange";
case LogEventLevel.Error:
return "red";
case LogEventLevel.Fatal:
return "purple";
default:
return "black";
}
}
}
}

493
WebApi.csproj Normal file
View File

@@ -0,0 +1,493 @@
<?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')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{64DFB865-859C-478B-96C6-AB52DCB1DE92}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>WebApi</RootNamespace>
<AssemblyName>WebApi</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AntdUI, Version=1.9.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\AntdUI.1.9.4\lib\net48\AntdUI.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Http.Abstractions, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.AspNetCore.Http.Abstractions.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Http.Extensions, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.AspNetCore.Http.Extensions.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Http.Features, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.AspNetCore.Http.Features.2.3.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Features.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.Configuration.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.2\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.FileProviders.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.FileProviders.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.FileProviders.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.Logging.Abstractions.8.0.2\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Options, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.Options.8.0.2\lib\net462\Microsoft.Extensions.Options.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.Primitives.8.0.0\lib\net462\Microsoft.Extensions.Primitives.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Net.Http.Headers, Version=2.3.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Net.Http.Headers.2.3.0\lib\netstandard2.0\Microsoft.Net.Http.Headers.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin, Version=4.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Owin.4.2.2\lib\net45\Microsoft.Owin.dll</HintPath>
</Reference>
<Reference Include="MQTTnet, Version=4.3.7.1207, Culture=neutral, PublicKeyToken=fdb7629f2e364a63, processorArchitecture=MSIL">
<HintPath>packages\MQTTnet.4.3.7.1207\lib\net48\MQTTnet.dll</HintPath>
</Reference>
<Reference Include="MQTTnet.Extensions.ManagedClient, Version=4.3.7.1207, Culture=neutral, PublicKeyToken=fdb7629f2e364a63, processorArchitecture=MSIL">
<HintPath>packages\MQTTnet.Extensions.ManagedClient.4.3.7.1207\lib\net48\MQTTnet.Extensions.ManagedClient.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json.Bson, Version=1.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.Bson.1.0.2\lib\net45\Newtonsoft.Json.Bson.dll</HintPath>
</Reference>
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<HintPath>packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="Serilog, Version=4.2.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>packages\Serilog.4.2.0\lib\net471\Serilog.dll</HintPath>
</Reference>
<Reference Include="Serilog.Sinks.File, Version=6.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>packages\Serilog.Sinks.File.6.0.0\lib\net471\Serilog.Sinks.File.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Design" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.IO.4.3.0\lib\net462\System.IO.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http.Formatting, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.AspNet.WebApi.Client.6.0.0\lib\net45\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Channels, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Threading.Channels.8.0.0\lib\net462\System.Threading.Channels.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web.Cors, Version=5.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.AspNet.Cors.5.3.0\lib\net45\System.Web.Cors.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http, Version=5.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.AspNet.WebApi.Core.5.3.0\lib\net45\System.Web.Http.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.Cors, Version=5.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.AspNet.WebApi.Cors.5.3.0\lib\net45\System.Web.Http.Cors.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.Owin, Version=5.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.AspNet.WebApi.Owin.5.3.0\lib\net45\System.Web.Http.Owin.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.SelfHost, Version=5.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.AspNet.WebApi.SelfHost.5.3.0\lib\net45\System.Web.Http.SelfHost.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Helpers\Gl.cs" />
<Compile Include="Helpers\Mqtt.cs" />
<Compile Include="Helpers\SqlServer.cs" />
<Compile Include="MainView.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainView.Designer.cs">
<DependentUpon>MainView.cs</DependentUpon>
</Compile>
<Compile Include="Models\Req\MES_To_AGV_From_WEB_Req.cs" />
<Compile Include="Models\Req\AGV_To_MES_AgvPass_Req.cs" />
<Compile Include="Tighten\Helpers\TightenHelpers.cs" />
<Compile Include="Tighten\Models\TightenTool.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Server\MqttServer.cs" />
<Compile Include="Tighten\TightenServer.cs" />
<Compile Include="Tools\AppConfigManage.cs" />
<Compile Include="Tools\Logger.cs" />
<Compile Include="WebApi\Helpers\ValidationHelper.cs" />
<Compile Include="WebApi\InitServer.cs" />
<Compile Include="WebApi\IFileController.cs" />
<Compile Include="WebApi\IOrderController.cs" />
<Compile Include="WebApi\Models\msgResHeader.cs" />
<Compile Include="WebApi\Models\test.cs" />
<Compile Include="WebApi\ServerController.cs" />
<EmbeddedResource Include="MainView.resx">
<DependentUpon>MainView.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="WindowForm\" />
</ItemGroup>
<ItemGroup>
<None Include="icon\002_列表.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\0780fca3def52d8a02649c7aa2f8093a.gif" />
</ItemGroup>
<ItemGroup>
<None Include="icon\action_Cancel_16xLG.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\BOSS-数据管理.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\HMI.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\JD.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\MBE风格多色图标-密码.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\panlClose.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\ssbj.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\staticjd.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\按键分割线.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\按键分割线浅.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\帮助.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\保存.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\备份_复制.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\编辑_修改.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\布局图.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\操作管理.jpg" />
</ItemGroup>
<ItemGroup>
<None Include="icon\错误_失败.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\打印机.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\导出.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\导入.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\登出2.jpg" />
</ItemGroup>
<ItemGroup>
<None Include="icon\登录.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\动态数据查询.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\断开.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\断开连接.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\断开状态.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\返回2.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\分布图.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\辅助_协助.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\更多.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\工具.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\工作台.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\关闭.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\关闭系统.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\合作.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\记录2.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\解锁.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\进度_沙漏.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\连接.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\连接状态.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\列表.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\列表2.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\零件管理.jpg" />
</ItemGroup>
<ItemGroup>
<None Include="icon\密码.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\配置.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\配置2.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\权限角色管理.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\任务监控和查询.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\日志.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\筛选.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\删除.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\上传.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\上载.jpg" />
</ItemGroup>
<ItemGroup>
<None Include="icon\审核_盖章.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\手动打印.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\刷新.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\搜索.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\锁定.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\添加.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\图表_饼.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\图表_线_通用_统计.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\图表_柱.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\退出.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\文档.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\系统管理.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\系统管理和监控服务.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\下载.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\写入托盘.jpg" />
</ItemGroup>
<ItemGroup>
<None Include="icon\新增_添加.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\信息_记录.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\业务.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\异常_危险.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\用户_账号_我的.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\用户_账号_我的_未登录.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\增加.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\正确_成功.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\质控管理.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\重新加载数据.png" />
</ItemGroup>
<ItemGroup>
<None Include="icon\组群_角色.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

25
WebApi.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.35122.118
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApi", "WebApi.csproj", "{64DFB865-859C-478B-96C6-AB52DCB1DE92}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{64DFB865-859C-478B-96C6-AB52DCB1DE92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{64DFB865-859C-478B-96C6-AB52DCB1DE92}.Debug|Any CPU.Build.0 = Debug|Any CPU
{64DFB865-859C-478B-96C6-AB52DCB1DE92}.Release|Any CPU.ActiveCfg = Release|Any CPU
{64DFB865-859C-478B-96C6-AB52DCB1DE92}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B28EDDAB-DA2D-415B-B254-D0051DAE4C96}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebApi
{
public class BusinessController
{
}
}

25
WebApi/Helpers/Gl.cs Normal file
View File

@@ -0,0 +1,25 @@
using System;
namespace WebApi.Helpers
{
/// <summary>
/// 全局变量类
/// </summary>
public class Gl
{
/// <summary>
/// SQL Server连接状态
/// </summary>
public static bool OnLine_Sql { get; set; } = false;
/// <summary>
/// AGV连接状态
/// </summary>
public static bool OnLine_AGV { get; set; } = false;
/// <summary>
/// MQTT连接状态
/// </summary>
public static bool OnLine_MQTT { get; set; } = false;
}
}

View File

@@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace WebApi.Helpers
{
public class ValidationHelper
{
/// <summary>
/// 验证对象的必填字段
/// </summary>
/// <typeparam name="T">要验证的对象类型</typeparam>
/// <param name="obj">要验证的对象</param>
/// <param name="errorMessage">错误信息</param>
/// <returns>验证是否通过</returns>
public static bool ValidateRequired<T>(T obj, out string errorMessage)
{
errorMessage = string.Empty;
if (obj == null)
{
errorMessage = "对象不能为空";
return false;
}
var properties = typeof(T).GetProperties();
foreach (var prop in properties)
{
var value = prop.GetValue(obj);
if (value == null)
{
errorMessage = $"【{prop.Name}不能为空】";
return false;
}
//else if (prop.PropertyType == typeof(int) && (int)value == 0)
//{
// errorMessage = $"【{prop.Name}不能为0】";
// return false;
//}
else if (prop.PropertyType == typeof(string) && string.IsNullOrEmpty((string)value))
{
errorMessage = $"【{prop.Name}不能为空】";
return false;
}
else if (prop.PropertyType == typeof(object) && (object)value == null)
{
errorMessage = $"【{prop.Name}不能为空】";
return false;
}
}
return true;
}
/// <summary>
/// 验证对象的指定字段
/// </summary>
/// <typeparam name="T">要验证的对象类型</typeparam>
/// <param name="obj">要验证的对象</param>
/// <param name="propertyNames">要验证的属性名列表</param>
/// <param name="errorMessage">错误信息</param>
/// <returns>验证是否通过</returns>
public static bool ValidateProperties<T>(T obj, string[] propertyNames, out string errorMessage)
{
errorMessage = string.Empty;
if (obj == null)
{
errorMessage = "对象不能为空";
return false;
}
foreach (var propName in propertyNames)
{
var prop = typeof(T).GetProperty(propName);
if (prop == null) continue;
var value = prop.GetValue(obj);
if (value == null)
{
errorMessage = $"【{propName}不能为空】";
return false;
}
//else if (prop.PropertyType == typeof(int) && (int)value == 0)
//{
// errorMessage = $"【{propName}不能为0】";
// return false;
//}
else if (prop.PropertyType == typeof(string) && string.IsNullOrEmpty((string)value))
{
errorMessage = $"【{propName}不能为空】";
return false;
}
}
return true;
}
}
}

277
WebApi/IFileController.cs Normal file
View File

@@ -0,0 +1,277 @@
using System.Net.Http;
using System.Net;
using System.Web.Http;
using Newtonsoft.Json.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System;
/////http://127.0.0.1:9981/api/file/browse
/// <summary>
///
/// </summary>
namespace WebApi
{
/// <summary>
///
/// </summary>
[RoutePrefix("api/file")]
public class IFileController : ApiController
{
// 基础路径配置
private readonly string _basePath = @"D:\项目文件";
/// <summary>
/// 请求DTO
/// </summary>
public class FileRequestDto
{
public string RelativePath { get; set; } = "";
}
/// <summary>
/// 浏览文件或文件夹,前端传相对路径,返回文件夹内容或文件流(图片等可预览)
/// </summary>
[HttpPost]
[Route("browse")]
public IHttpActionResult BrowsePath([FromBody] FileRequestDto request)
{
try
{
if (request == null)
request = new FileRequestDto();
if (string.IsNullOrEmpty(request.RelativePath) || request.RelativePath == "/")
{
request.RelativePath = "";
}
string fullPath = Path.Combine(_basePath, request.RelativePath.Replace('/', Path.DirectorySeparatorChar));
if (!IsPathSafe(fullPath))
{
return Ok(new { success = false, message = "无效的路径" });
}
if (!Directory.Exists(fullPath) && !System.IO.File.Exists(fullPath))
{
return Ok(new { success = false, message = "路径不存在" });
}
if (System.IO.File.Exists(fullPath))
{
return GetFilePreview(fullPath, request.RelativePath);
}
if (Directory.Exists(fullPath))
{
return GetDirectoryContents(fullPath, request.RelativePath);
}
return Ok(new { success = false, message = "路径不存在" });
}
catch (Exception ex)
{
return Ok(new { success = false, message = $"服务器错误: {ex.Message}" });
}
}
/// <summary>
/// 获取文件预览数据(图片/文本base64前端可直接预览
/// </summary>
private IHttpActionResult GetFilePreview(string fullPath, string relativePath)
{
try
{
var fileInfo = new FileInfo(fullPath);
var extension = fileInfo.Extension.ToLowerInvariant();
var previewable = IsPreviewableFile(extension);
var contentType = GetContentType(fileInfo.Name);
bool tooLarge = fileInfo.Length > 10 * 1024 * 1024; // 10MB限制
string base64String = null;
string dataUrl = null;
bool canPreview = previewable && !tooLarge;
if (canPreview)
{
var fileBytes = System.IO.File.ReadAllBytes(fullPath);
base64String = Convert.ToBase64String(fileBytes);
dataUrl = $"data:{contentType};base64,{base64String}";
}
var result = new
{
success = true,
type = "file",
path = relativePath,
name = fileInfo.Name,
size = fileInfo.Length,
extension = fileInfo.Extension,
contentType = contentType,
isPreviewable = canPreview,
base64Data = base64String,
dataUrl = dataUrl,
created = fileInfo.CreationTime,
modified = fileInfo.LastWriteTime,
message = tooLarge ? "文件过大,无法预览,可下载" : null
};
return Ok(result);
}
catch (Exception ex)
{
return Ok(new { success = false, message = $"获取文件预览失败: {ex.Message}" });
}
}
/// <summary>
/// 判断文件是否可预览
/// </summary>
private bool IsPreviewableFile(string extension)
{
var previewableExtensions = new[]
{
".bmp", ".jpg", ".jpeg", ".png", ".gif", ".tiff", ".tif", ".webp",
".txt", ".json", ".xml", ".csv", ".log", ".md"
};
return previewableExtensions.Contains(extension);
}
/// <summary>
/// 安全检查:确保路径在基础目录内,防止路径遍历攻击
/// </summary>
private bool IsPathSafe(string fullPath)
{
try
{
var basePath = Path.GetFullPath(_basePath);
var requestedPath = Path.GetFullPath(fullPath);
return requestedPath.StartsWith(basePath, StringComparison.OrdinalIgnoreCase);
}
catch
{
return false;
}
}
/// <summary>
/// 根据文件扩展名获取MIME类型兼容C# 7.3
/// </summary>
private string GetContentType(string fileName)
{
var extension = Path.GetExtension(fileName).ToLowerInvariant();
if (extension == ".bmp") return "image/bmp";
if (extension == ".jpg" || extension == ".jpeg") return "image/jpeg";
if (extension == ".png") return "image/png";
if (extension == ".gif") return "image/gif";
if (extension == ".tiff" || extension == ".tif") return "image/tiff";
if (extension == ".webp") return "image/webp";
if (extension == ".pdf") return "application/pdf";
if (extension == ".txt") return "text/plain";
if (extension == ".json") return "application/json";
if (extension == ".xml") return "application/xml";
if (extension == ".csv") return "text/csv";
if (extension == ".md") return "text/markdown";
if (extension == ".log") return "text/plain";
if (extension == ".zip") return "application/zip";
if (extension == ".rar") return "application/x-rar-compressed";
return "application/octet-stream";
}
private IHttpActionResult GetDirectoryContents(string fullPath, string relativePath)
{
try
{
var items = new List<object>();
var directories = Directory.GetDirectories(fullPath);
foreach (var dir in directories)
{
var dirInfo = new DirectoryInfo(dir);
var subPath = string.IsNullOrEmpty(relativePath)
? dirInfo.Name
: $"{relativePath}/{dirInfo.Name}";
items.Add(new
{
name = dirInfo.Name,
type = "directory",
path = subPath,
created = dirInfo.CreationTime,
modified = dirInfo.LastWriteTime,
isPreviewable = false
});
}
var files = Directory.GetFiles(fullPath);
foreach (var file in files)
{
var fileInfo = new FileInfo(file);
var filePath = string.IsNullOrEmpty(relativePath)
? fileInfo.Name
: $"{relativePath}/{fileInfo.Name}";
var extension = fileInfo.Extension.ToLowerInvariant();
items.Add(new
{
name = fileInfo.Name,
type = "file",
path = filePath,
size = fileInfo.Length,
extension = fileInfo.Extension,
created = fileInfo.CreationTime,
modified = fileInfo.LastWriteTime,
isPreviewable = IsPreviewableFile(extension),
contentType = GetContentType(fileInfo.Name)
});
}
var result = new
{
success = true,
type = "directory",
path = relativePath,
items = items.OrderBy(x => ((dynamic)x).type == "directory" ? 0 : 1)
.ThenBy(x => ((dynamic)x).name)
.ToList()
};
return Ok(result);
}
catch (Exception ex)
{
return Ok(new { success = false, message = $"读取目录失败: {ex.Message}" });
}
}
[HttpPost]
[Route("download")]
public IHttpActionResult DownloadFile([FromBody] FileRequestDto request)
{
try
{
if (request == null || string.IsNullOrEmpty(request.RelativePath))
return Ok(new { success = false, message = "文件路径不能为空" });
string fullPath = Path.Combine(_basePath, request.RelativePath.Replace('/', Path.DirectorySeparatorChar));
if (!IsPathSafe(fullPath) || !System.IO.File.Exists(fullPath))
return Ok(new { success = false, message = "文件不存在" });
var fileInfo = new FileInfo(fullPath);
var contentType = GetContentType(fileInfo.Name);
var response = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StreamContent(new FileStream(fullPath, FileMode.Open, FileAccess.Read, FileShare.Read))
};
response.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(contentType);
response.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment")
{
FileName = fileInfo.Name
};
return ResponseMessage(response);
}
catch (Exception ex)
{
return Ok(new { success = false, message = $"下载文件失败: {ex.Message}" });
}
}
}
}

View File

@@ -0,0 +1,81 @@
using System.Net.Http;
using System.Text;
using System.Web.Http;
using Newtonsoft.Json.Linq;
using System.Threading.Tasks;
/////http://127.0.0.1:9981/api/IOrder/InsertOrder
/// <summary>
///
/// </summary>
namespace WebApi
{
/// <summary>
///
/// </summary>
[RoutePrefix("api/imes")]
public class imesController : ApiController
{
readonly string headUrl = "api/imes/";
[HttpPost]
public HttpResponseMessage TestPost([FromBody] JObject jobj)
{
if (jobj == null) jobj = new JObject();
return new HttpResponseMessage
{
Content = new StringContent(ServerController.TestPost(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj.ToString()), Encoding.GetEncoding("UTF-8"), "application/json")
};
}
/// <summary>
/// WEB发送请求给WEB API 注意 这是异步操作
/// </summary>
/// <param name="jobj"></param>
/// <returns></returns>
[HttpPost]
public async Task<HttpResponseMessage> MES_To_AGV_From_WEB([FromBody] JObject jobj)
{
if (jobj == null) jobj = new JObject();
var result = await ServerController.MES_To_AGV_From_WEB(headUrl + "MES_To_AGV_From_WEB", jobj.ToString());
return new HttpResponseMessage
{
Content = new StringContent(result, Encoding.GetEncoding("UTF-8"), "application/json")
};
}
/// <summary>
/// WEB发送请求给WEB API 注意 这是异步操作
/// 测试版
/// </summary>
/// <param name="jobj"></param>
/// <returns></returns>
[HttpPost]
public async Task<HttpResponseMessage> MES_To_AGV_From_WEB_Test([FromBody] JObject jobj)
{
if (jobj == null) jobj = new JObject();
var result = await ServerController.MES_To_AGV_From_WEB_Test(headUrl + "MES_To_AGV_From_WEB_Test", jobj.ToString());
return new HttpResponseMessage
{
Content = new StringContent(result, Encoding.GetEncoding("UTF-8"), "application/json")
};
}
/// <summary>
/// AGV与MES站点交互
/// </summary>
/// <param name="jobj"></param>
/// <returns></returns>
[HttpPost]
public async Task<HttpResponseMessage> AGV_To_MES_AgvPass([FromBody] JObject jobj)
{
if (jobj == null) jobj = new JObject();
var result = await ServerController.AGV_To_MES_AgvPass(headUrl + "AGV_To_MES_AgvPass", jobj.ToString());
return new HttpResponseMessage
{
Content = new StringContent(result, Encoding.GetEncoding("UTF-8"), "application/json")
};
}
}
}

142
WebApi/InitServer.cs Normal file
View File

@@ -0,0 +1,142 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
using System.Text;
using System.Web.Http;
using System.Web.Http.Cors;
using System.Web.Http.SelfHost;
namespace WebApi
{
/// <summary>
///
/// </summary>
public class InitServer
{
/// <summary>
///
/// </summary>
HttpSelfHostConfiguration config = null;
/// <summary>
///
/// </summary>
HttpSelfHostServer server = null;
/// <summary>
///
/// </summary>
/// <param name="port"></param>
public InitServer(int port)
{
config = new HttpSelfHostConfiguration($"http://0.0.0.0:{port}");
config.EnableCors(new EnableCorsAttribute("*", "*", "*"));
config.MapHttpAttributeRoutes();
//config.Routes.MapHttpRoute(
// name: "DefaultApi",
// routeTemplate: "api/{controller}/{id}",
// defaults: new { id = RouteParameter.Optional }
//);
// 自定义路由匹配到action
config.Routes.MapHttpRoute(
name: "API Default",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
server = new HttpSelfHostServer(config);
server.OpenAsync().Wait();
}
public void Close()
{
server.CloseAsync();
}
/// <summary>
///
/// </summary>
public class JsonContentNegotiator : IContentNegotiator
{
/// <summary>
///
/// </summary>
private readonly JsonMediaTypeFormatter _jsonFormatter;
/// <summary>
///
/// </summary>
/// <param name="formatter"></param>
public JsonContentNegotiator(JsonMediaTypeFormatter formatter)
{
_jsonFormatter = formatter;
}
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <param name="request"></param>
/// <param name="formatters"></param>
/// <returns></returns>
public ContentNegotiationResult Negotiate(Type type, HttpRequestMessage request, IEnumerable<MediaTypeFormatter> formatters)
{
var result = new ContentNegotiationResult(_jsonFormatter, new MediaTypeHeaderValue("application/json"));
return result;
}
public static string Postring1(string url, string token, Dictionary<string, string> dic)
{
string results = "";
//url = "http://172.16.22.15:8000/" + url;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.Headers.Add("Authorization", "Bearer " + token);
StringBuilder builder = new StringBuilder();
int i = 0;
foreach (var item in dic)
{
if (i > 0)
builder.Append("&");
builder.AppendFormat("{0}={1}", item.Key, item.Value);
i++;
}
byte[] data = Encoding.UTF8.GetBytes(builder.ToString());
req.ContentLength = data.Length;
try
{
using (Stream reqStream = req.GetRequestStream())
{
reqStream.Write(data, 0, data.Length);
reqStream.Close();
}
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream();
//获取响应内容
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
results = reader.ReadToEnd();
}
return results;
}
catch (Exception e)
{
Console.WriteLine(e.Message);
return e.Message;
throw;
}
}
}
}
}

View File

@@ -0,0 +1,33 @@
using System;
namespace WebApi.Models
{
public class AGV_To_MES_AgvArrive_Req
{
/// <summary>
/// 任务号 唯一ID
/// </summary>
public string taskId
{
get;
set;
}
/// <summary>
/// 工位号
/// </summary>
public string station
{
get;
set;
}
/// <summary>
/// AGV编号
/// </summary>
public int agvNum
{
get;
set;
}
}
}

View File

@@ -0,0 +1,89 @@
using System;
namespace WebApi.Models
{
public class AGV_To_MES_AgvMateria_Req
{
/// <summary>
/// 任务号 唯一ID
/// </summary>
public string taskId
{
get;
set;
}
/// <summary>
/// 客户端 固定值agv
/// </summary>
public string clientId
{
get;
set;
}
/// <summary>
/// 任务类型 0叫料1送料2叫空托3送空托4点对点5退料
/// </summary>
public int taskType
{
get;
set;
}
/// <summary>
/// 任务状态 3任务取消 21取货完成 23 放完
/// </summary>
public int status
{
get;
set;
}
/// <summary>
/// 取料点 taskType为134时必填
/// </summary>
public string pickStock
{
get;
set;
}
/// <summary>
/// 放料点 taskType为024时必填
/// </summary>
public string dropStock
{
get;
set;
}
/// <summary>
/// 托盘号
/// </summary>
public string palletId
{
get;
set;
}
/// <summary>
/// 物料号 物料编码(叫料时必填)
/// </summary>
public string materialId
{
get;
set;
}
/// <summary>
/// 需求数量
/// </summary>
public int requireNum
{
get;
set;
}
/// <summary>
/// 下发时间
/// </summary>
public string createTime
{
get;
set;
}
}
}

View File

@@ -0,0 +1,65 @@
using System;
namespace WebApi.Models
{
public class AGV_To_MES_AgvPass_Req
{
/// <summary>
/// 任务号 唯一ID
/// </summary>
public string taskId
{
get;
set;
}
/// <summary>
/// 工位号
/// </summary>
public string station
{
get;
set;
}
/// <summary>
/// 0到位1离开
/// </summary>
public int type
{
get;
set;
}
/// <summary>
/// AGV编号
/// </summary>
public int agvNum
{
get;
set;
}
/// <summary>
/// 总成编号
/// </summary>
public string EngineNo
{
get;
set;
}
/// <summary>
/// 订单号
/// </summary>
public string OrderNo
{
get;
set;
}
/// <summary>
/// 机型号
/// </summary>
public string SortNo
{
get;
set;
}
}
}

View File

@@ -0,0 +1,31 @@
namespace WebApi.Models
{
public class msgResHeader
{
/// <summary>
/// 返回结果 bool
/// </summary>
public bool Result
{
get;
set;
}
/// <summary>
/// 返回消息
/// </summary>
public string ErrMsg
{
get;
set;
}
/// <summary>
/// 返回结果集
/// </summary>
public object Data
{
get;
set;
}
}
}

23
WebApi/Models/test.cs Normal file
View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebApi.Models
{
public class test
{
public string msg
{
get;
set;
}
public int code
{
get;
set;
}
}
}

418
WebApi/ServerController.cs Normal file
View File

@@ -0,0 +1,418 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using WebApi.Models;
using WebApi.Helpers;
using System.Reflection;
using Logger;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace WebApi
{
public class ServerController
{
private static readonly HttpClient httpClient;
public static event Action<string> ShowMsg; // 记录日志事件
static ServerController()
{
httpClient = new HttpClient();
httpClient.Timeout = TimeSpan.FromSeconds(20); // 设置超时时间为20秒
}
/// <summary>
/// UUID生成
/// </summary>
/// <returns></returns>
public static string UuidUtil()
{
string result = Guid.NewGuid().ToString();
return result;
}
public static int SaveWebApiReqLogo(string url, string JSON)
{
int AID = -1;
try
{
//存储日志
var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
var param = new Dictionary<string, Object>{
{ "接口地址", url },
{ "接口类型", 2 },
{ "请求内容", JSON },
{ "请求时间", CreateTime }
};
SqlServer.ExecuteProcedure("接口_IOT接口交互日志_请求记录", param, out DataTable dt, out string err);
if (dt.Rows.Count > 0)
{
AID = Convert.ToInt32(dt.Rows[0]["AID"]);
}
}
catch (Exception ex)
{
Log.FunError(ex, MethodBase.GetCurrentMethod().Name);
}
return AID;
}
public static int SaveWebApiResLogo(int AID, string JSON)
{
try
{
//new SqlParameter("@AID",AID),
//new SqlParameter("@响应时间",CreateTime),
//new SqlParameter("@响应内容",JsonConvert.SerializeObject(result))
//存储日志
var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
var param = new Dictionary<string, Object>{
{ "AID", AID },
{ "响应时间", CreateTime },
{ "响应内容", JSON },
};
SqlServer.ExecuteProcedure("接口_IOT接口交互日志_响应记录", param, out DataTable dt, out string err);
if (dt.Rows.Count > 0)
{
AID = Convert.ToInt32(dt.Rows[0]["AID"]);
}
}
catch (Exception ex)
{
Log.FunError(ex, MethodBase.GetCurrentMethod().Name);
}
return AID;
}
/// <summary>
/// 测试标准接口方法
/// </summary>
/// <param name="url"></param>
/// <param name="str"></param>
/// <returns></returns>
public static string TestPost(string url, string json)
{
var result = new msgResHeader();
//result.taskId = UuidUtil();
result.Result = false;
result.ErrMsg = "";
result.Data = "";
string errorMessage = "";
int AID = -1;
try
{
AID = SaveWebApiReqLogo(url, json);
// 解析订单内容,存储数据库,根据实际业务来写
test personnelBaseData = JsonConvert.DeserializeObject<test>(json);
ShowMsg?.Invoke("【" + url + "】code" + personnelBaseData.code + ",msg:" + personnelBaseData.msg);
//result.msg = errorMessage;
AID = SaveWebApiResLogo(AID, JsonConvert.SerializeObject(result));
}
catch (Exception err)
{
result.Result = false;
result.ErrMsg = err.Message;
result.Data = "ERROR";
Log.FunError(err, MethodBase.GetCurrentMethod().Name);
}
return JsonConvert.SerializeObject(result);
}
/// <summary>
/// 前端对AGV通用的接口转发
/// </summary>
/// <param name="url"></param>
/// <param name="str"></param>
/// <returns></returns>
public static async Task<string> MES_To_AGV_From_WEB(string url, string json)
{
var result = new msgResHeader();
result.Result = false;
result.ErrMsg = "";
result.Data = "";
string errorMessage = "";
int AID = -1;
try
{
// 显示一下接口日志
ShowMsg?.Invoke("Receive【" + url + "】" + json);
AID = SaveWebApiReqLogo(url, json);
MES_To_AGV_From_WEB_Req personnelBaseData = JsonConvert.DeserializeObject<MES_To_AGV_From_WEB_Req>(json);
// 验证必填字段
if (!ValidationHelper.ValidateRequired(personnelBaseData, out errorMessage))
{
ShowMsg?.Invoke($"****************{errorMessage}");
result.ErrMsg = errorMessage;
return JsonConvert.SerializeObject(result);
}
string AGVApiBaseUrl = Tools.AppConfigManage.ReadConfig("AGVApiBaseUrl");
string AGVIP = Tools.AppConfigManage.ReadConfig("AGVIP");
string AGVApiUrl = "http://" + AGVIP + AGVApiBaseUrl + personnelBaseData.url;
// 发送POST请求
var content = new StringContent(
JsonConvert.SerializeObject(personnelBaseData.data),
Encoding.UTF8,
"application/json"
);
var response = await httpClient.PostAsync(AGVApiUrl, content);
var responseContent = await response.Content.ReadAsStringAsync();
if (response.IsSuccessStatusCode)
{
result.Result = true;
result.Data = responseContent;
}
else
{
result.Result = false;
result.ErrMsg = $"请求失败: {response.StatusCode} - {responseContent}";
}
AID = SaveWebApiResLogo(AID, JsonConvert.SerializeObject(result));
}
catch (TaskCanceledException ex)
{
if (!ex.CancellationToken.IsCancellationRequested)
{
ShowMsg?.Invoke("请求超时,请检查目标服务是否可达或响应过慢!");
result.ErrMsg = "请求超时,请检查目标服务是否可达或响应过慢!";
}
else
{
ShowMsg?.Invoke("请求被主动取消!");
result.ErrMsg = "请求被主动取消!";
}
result.Data = "ERROR";
Log.FunError(ex, MethodBase.GetCurrentMethod().Name);
}
catch (Exception err)
{
result.Result = false;
result.ErrMsg = err.Message;
result.Data = "ERROR";
Log.FunError(err, MethodBase.GetCurrentMethod().Name);
}
return JsonConvert.SerializeObject(result);
}
/// <summary>
/// 前端对AGV通用的接口转发
/// 测试版
/// </summary>
/// <param name="url"></param>
/// <param name="str"></param>
/// <returns></returns>
public static async Task<string> MES_To_AGV_From_WEB_Test(string url, string json)
{
var result = new msgResHeader();
result.Result = false;
result.ErrMsg = "";
result.Data = "";
string errorMessage = "";
int AID = -1;
try
{
// 显示一下接口日志
ShowMsg?.Invoke("Receive【" + url + "】" + json);
AID = SaveWebApiReqLogo(url, json);
var result2 = new msgResHeader();
result2.Result = true;
result2.ErrMsg = "";
result2.Data = "";
MES_To_AGV_From_WEB_Req personnelBaseData = JsonConvert.DeserializeObject<MES_To_AGV_From_WEB_Req>(json);
// 验证必填字段
if (!ValidationHelper.ValidateRequired(personnelBaseData, out errorMessage))
{
ShowMsg?.Invoke($"****************{errorMessage}");
result.ErrMsg = errorMessage;
return JsonConvert.SerializeObject(result);
}
// 手动模拟
// 接口1 库区列表查询 返回固定JSON数据
if(personnelBaseData.url == "getPartitionList")
{
var partitionList = new List<object>
{
new { PartitionCode = "1", PartitionName = "隔离开关操作试验区" },
new { PartitionCode = "2", PartitionName = "断路器线边缓存位" },
new { PartitionCode = "3", PartitionName = "CT装配区" },
new { PartitionCode = "4", PartitionName = "断路器下线" },
new { PartitionCode = "5", PartitionName = "OP30产线工位" },
new { PartitionCode = "6", PartitionName = "线边缓存库" },
new { PartitionCode = "7", PartitionName = "断路器试验区" },
new { PartitionCode = "8", PartitionName = "隔离开关安装操作缓存区" },
new { PartitionCode = "9", PartitionName = "隔离开关下线" },
new { PartitionCode = "10", PartitionName = "断路器缓存区" },
new { PartitionCode = "11", PartitionName = "OP20产线工位" },
new { PartitionCode = "12", PartitionName = "OP10产线工位" }
};
result.Result = true;
result2.Data = partitionList;
result.Data = JsonConvert.SerializeObject(result2);
}
// 接口2 库位列表查询 返回固定JSON数据
if(personnelBaseData.url == "getStockList")
{
var stockList = new List<object>
{
// StockCode 库位编号
// StockName 库位名称
// StockStatus 满料状态 bool
// PalletCode 托盘编号
// EngineNo 产品编号
// SortNo 产品型号
// TaskId 任务号
new { StockCode = "6", StockName = "工位线边缓存位1", StockStatus = true, PalletCode = "pallTestCode1", EngineNo = "GCBTest01", SortNo = "P7223814G003", TaskId = "12312" },
new { StockCode = "16", StockName = "工位线边缓存位2", StockStatus = true, PalletCode = "pallTestCode2", EngineNo = "CTTest01-1", SortNo = "P7223363G001", TaskId = (string)null },
new { StockCode = "30", StockName = "工位线边缓存位3", StockStatus = false, PalletCode = "pallTestCode3", EngineNo = (string)null, SortNo = (string)null, TaskId = (string)null },
new { StockCode = "2", StockName = "工位线边缓存位4", StockStatus = false, PalletCode = (string)null, EngineNo = (string)null, SortNo = (string)null, TaskId = (string)null },
};
result.Result = true;
result2.Data = stockList;
result.Data = JsonConvert.SerializeObject(result2);
}
// 接口3 更新库位信息
if (personnelBaseData.url == "updateStockInfo")
{
result.Result = true;
result.Data = JsonConvert.SerializeObject(result2);
}
// 接口4 创建送料任务
if (personnelBaseData.url == "createTask")
{
result.Result = true;
result.Data = JsonConvert.SerializeObject(result2);
}
AID = SaveWebApiResLogo(AID, JsonConvert.SerializeObject(result));
}
catch (TaskCanceledException ex)
{
if (!ex.CancellationToken.IsCancellationRequested)
{
ShowMsg?.Invoke("请求超时,请检查目标服务是否可达或响应过慢!");
result.ErrMsg = "请求超时,请检查目标服务是否可达或响应过慢!";
}
else
{
ShowMsg?.Invoke("请求被主动取消!");
result.ErrMsg = "请求被主动取消!";
}
result.Data = "ERROR";
Log.FunError(ex, MethodBase.GetCurrentMethod().Name);
}
catch (Exception err)
{
result.Result = false;
result.ErrMsg = err.Message;
result.Data = "ERROR";
Log.FunError(err, MethodBase.GetCurrentMethod().Name);
}
return JsonConvert.SerializeObject(result);
}
/// <summary>
/// AGV到位,离开
/// </summary>
/// <param name="url"></param>
/// <param name="str"></param>
/// <returns></returns>
public static async Task<string> AGV_To_MES_AgvPass(string url, string json)
{
var result = new msgResHeader();
result.Result = false;
result.ErrMsg = "";
result.Data = "";
string errorMessage = "";
int AID = -1;
try
{
// 显示一下接口日志
ShowMsg?.Invoke("Receive【" + url + "】" + json);
AID = SaveWebApiReqLogo(url, json);
// 解析订单内容,存储数据库,根据实际业务来写
AGV_To_MES_AgvPass_Req personnelBaseData = JsonConvert.DeserializeObject<AGV_To_MES_AgvPass_Req>(json);
// 验证必填字段
if (!ValidationHelper.ValidateRequired(personnelBaseData, out errorMessage))
{
ShowMsg?.Invoke($"****************{errorMessage}");
result.ErrMsg = errorMessage;
return JsonConvert.SerializeObject(result);
}
int workOverType = 0;
if (personnelBaseData.type == 0)
{
workOverType = 1;
}
else if (personnelBaseData.type == 1)
{
workOverType = 3;
}
else
{
ShowMsg?.Invoke($"****************未识别的type{workOverType}");
result.ErrMsg = $"未识别的Type{workOverType}";
return JsonConvert.SerializeObject(result);
}
var param = new Dictionary<string, Object>{
{ "工位号", personnelBaseData.station },
{ "任务编号", personnelBaseData.taskId },
{ "工件编号", personnelBaseData.EngineNo },
{ "type", workOverType},
};
SqlServer.ExecuteProcedure("PTCHV_AGV_进离站", param, out DataTable dt, out errorMessage);
// 验证必填字段
if (errorMessage.Length > 0)
{
ShowMsg?.Invoke($"****************{errorMessage}");
result.ErrMsg = errorMessage;
return JsonConvert.SerializeObject(result);
}
await MqttServer.SendMqttMessageToOp(personnelBaseData.station, "AGVStatus", workOverType.ToString());
result.Result = true;
AID = SaveWebApiResLogo(AID, JsonConvert.SerializeObject(result));
}
catch (Exception err)
{
result.Result = false;
result.ErrMsg = err.Message;
result.Data = "ERROR";
Log.FunError(err, MethodBase.GetCurrentMethod().Name);
}
return JsonConvert.SerializeObject(result);
}
}
}

BIN
icon/002_列表.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
icon/BOSS-数据管理.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
icon/BOSS-数据管理.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
icon/HMI.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
icon/JD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
icon/Mes32X32.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

BIN
icon/bitbug_favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
icon/excelICON.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
icon/jk.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
icon/panlClose.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
icon/ssbj.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
icon/staticjd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
icon/上传.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
icon/上载.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
icon/下载.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
icon/业务.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
icon/保存.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
icon/信息_记录.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
icon/关闭.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
icon/关闭系统.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
icon/写入托盘.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
icon/分布图.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
icon/分布图.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

BIN
icon/列表.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
icon/列表2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
icon/删除.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
icon/刷新.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
icon/动态数据查询.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
icon/合作.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

BIN
icon/图表_柱.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
icon/图表_饼.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

BIN
icon/增加.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

BIN
icon/备份_复制.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
icon/审核_盖章.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
icon/密码.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
icon/导入.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
icon/导出.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
icon/工作台.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
icon/工具.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
icon/布局图.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 KiB

BIN
icon/帮助.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

BIN
icon/异常_危险.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
icon/手动打印.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

BIN
icon/打印机.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
icon/按键分割线.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
icon/按键分割线浅.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
icon/搜索.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

BIN
icon/操作管理.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

BIN
icon/文档.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
icon/断开.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

BIN
icon/断开状态.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
icon/断开连接.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
icon/新增_添加.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
icon/日志.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
icon/日志.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
icon/更多.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
icon/权限角色管理.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

BIN
icon/正确_成功.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
icon/添加.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Some files were not shown because too many files have changed in this diff Show More