上传当前项目状态

This commit is contained in:
2026-05-23 13:54:15 +08:00
parent 3b871f24b3
commit 0e3250c8b8
32 changed files with 22267 additions and 22099 deletions

13
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,13 @@
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Framework: WC_GKJ_OIL",
"type": "clr",
"request": "launch",
"program": "${workspaceFolder}\\WC_GKJ_OIL_EXE\\WC_GKJ_OIL.exe",
"cwd": "${workspaceFolder}\\WC_GKJ_OIL_EXE",
"preLaunchTask": "build Debug"
}
]
}

3
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"dotnet.preferCSharpExtension": true
}

22
.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,22 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build Debug",
"type": "process",
"command": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\MSBuild\\Current\\Bin\\MSBuild.exe",
"args": [
"${workspaceFolder}\\WC_GKJ_OIL_SLN.sln",
"/restore",
"/m",
"/p:Configuration=Debug",
"/p:Platform=Any CPU"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$msCompile"
}
]
}

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<appSettings> <appSettings>
<add key="IsDemoMesServer" value="1"/> <add key="IsDemoMesServer" value="0"/>
<add key="BasicDataTableFile" value="SignalTable_CZ.xlsx"/> <add key="BasicDataTableFile" value="SignalTable_CZ.xlsx"/>
<add key="IsAllowWrite" value="1"/> <add key="IsAllowWrite" value="1"/>
<!--是启用写监控报错日志--> <!--是启用写监控报错日志-->
@@ -15,7 +15,7 @@
<add key="Station1OpName" value="ST04"/> <add key="Station1OpName" value="ST04"/>
<add key="Station2OpName" value="ST05"/> <add key="Station2OpName" value="ST05"/>
<!--数据库连接--> <!--数据库连接-->
<add key="ConnectionString" value="server=.,1333;database=MESBasicDB_WC_CZGKJ;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000"/> <add key="ConnectionString" value="server=LAPTOP-ELBDN3OJ\SQLEXPRESS;database=MESBasicDB_WC_CZGKJ;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000"/>
<!--WebApi--> <!--WebApi-->
<add key="WebApi_Port" value="9981"/> <add key="WebApi_Port" value="9981"/>
@@ -33,7 +33,7 @@
<!--曲线稳定窗口点数--> <!--曲线稳定窗口点数-->
<add key="CurveStableWindowSize" value="20"/> <add key="CurveStableWindowSize" value="20"/>
<!--最终重量计算时跳过前置称重点数0=不跳过--> <!--最终重量计算时跳过前置称重点数0=不跳过-->
<add key="CurveStableSkipStartPointCount" value="0"/> <add key="CurveStableSkipStartPointCount" value="50"/>
</appSettings> </appSettings>
<startup> <startup>

View File

@@ -30,19 +30,28 @@ namespace MesWork
this.pnl_Card.SuspendLayout(); this.pnl_Card.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// pnl_Card - 白色登录卡片 // pnl_Card
// //
this.pnl_Card.BackColor = System.Drawing.Color.White; this.pnl_Card.BackColor = System.Drawing.Color.White;
this.pnl_Card.Controls.Add(this.lbl_Title);
this.pnl_Card.Controls.Add(this.lbl_SubTitle);
this.pnl_Card.Controls.Add(this.lbl_User);
this.pnl_Card.Controls.Add(this.txt_LoginID);
this.pnl_Card.Controls.Add(this.lbl_Pwd);
this.pnl_Card.Controls.Add(this.txt_userPassword);
this.pnl_Card.Controls.Add(this.btn_Login);
this.pnl_Card.Controls.Add(this.btn_Cancel);
this.pnl_Card.Controls.Add(this.lbl_Msg);
this.pnl_Card.Location = new System.Drawing.Point(310, 180); this.pnl_Card.Location = new System.Drawing.Point(310, 180);
this.pnl_Card.Name = "pnl_Card"; this.pnl_Card.Name = "pnl_Card";
this.pnl_Card.Size = new System.Drawing.Size(400, 380); this.pnl_Card.Size = new System.Drawing.Size(400, 380);
this.pnl_Card.TabIndex = 0; this.pnl_Card.TabIndex = 0;
this.pnl_Card.Paint += new System.Windows.Forms.PaintEventHandler(this.pnl_Card_Paint); this.pnl_Card.Paint += new System.Windows.Forms.PaintEventHandler(this.pnl_Card_Paint);
// //
// lbl_Title - 系统图标+名称 // lbl_Title
// //
this.lbl_Title.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold); this.lbl_Title.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold);
this.lbl_Title.ForeColor = System.Drawing.Color.FromArgb(30, 58, 95); this.lbl_Title.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(58)))), ((int)(((byte)(95)))));
this.lbl_Title.Location = new System.Drawing.Point(20, 30); this.lbl_Title.Location = new System.Drawing.Point(20, 30);
this.lbl_Title.Name = "lbl_Title"; this.lbl_Title.Name = "lbl_Title";
this.lbl_Title.Size = new System.Drawing.Size(360, 40); this.lbl_Title.Size = new System.Drawing.Size(360, 40);
@@ -53,7 +62,7 @@ namespace MesWork
// lbl_SubTitle // lbl_SubTitle
// //
this.lbl_SubTitle.Font = new System.Drawing.Font("微软雅黑", 11F); this.lbl_SubTitle.Font = new System.Drawing.Font("微软雅黑", 11F);
this.lbl_SubTitle.ForeColor = System.Drawing.Color.FromArgb(107, 114, 128); this.lbl_SubTitle.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(114)))), ((int)(((byte)(128)))));
this.lbl_SubTitle.Location = new System.Drawing.Point(20, 72); this.lbl_SubTitle.Location = new System.Drawing.Point(20, 72);
this.lbl_SubTitle.Name = "lbl_SubTitle"; this.lbl_SubTitle.Name = "lbl_SubTitle";
this.lbl_SubTitle.Size = new System.Drawing.Size(360, 24); this.lbl_SubTitle.Size = new System.Drawing.Size(360, 24);
@@ -64,7 +73,7 @@ namespace MesWork
// lbl_User // lbl_User
// //
this.lbl_User.Font = new System.Drawing.Font("微软雅黑", 10F); this.lbl_User.Font = new System.Drawing.Font("微软雅黑", 10F);
this.lbl_User.ForeColor = System.Drawing.Color.FromArgb(55, 65, 81); this.lbl_User.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(55)))), ((int)(((byte)(65)))), ((int)(((byte)(81)))));
this.lbl_User.Location = new System.Drawing.Point(40, 120); this.lbl_User.Location = new System.Drawing.Point(40, 120);
this.lbl_User.Name = "lbl_User"; this.lbl_User.Name = "lbl_User";
this.lbl_User.Size = new System.Drawing.Size(60, 24); this.lbl_User.Size = new System.Drawing.Size(60, 24);
@@ -85,7 +94,7 @@ namespace MesWork
// lbl_Pwd // lbl_Pwd
// //
this.lbl_Pwd.Font = new System.Drawing.Font("微软雅黑", 10F); this.lbl_Pwd.Font = new System.Drawing.Font("微软雅黑", 10F);
this.lbl_Pwd.ForeColor = System.Drawing.Color.FromArgb(55, 65, 81); this.lbl_Pwd.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(55)))), ((int)(((byte)(65)))), ((int)(((byte)(81)))));
this.lbl_Pwd.Location = new System.Drawing.Point(40, 195); this.lbl_Pwd.Location = new System.Drawing.Point(40, 195);
this.lbl_Pwd.Name = "lbl_Pwd"; this.lbl_Pwd.Name = "lbl_Pwd";
this.lbl_Pwd.Size = new System.Drawing.Size(60, 24); this.lbl_Pwd.Size = new System.Drawing.Size(60, 24);
@@ -104,9 +113,9 @@ namespace MesWork
this.txt_userPassword.Text = "admin"; this.txt_userPassword.Text = "admin";
this.txt_userPassword.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txt_userPassword_KeyDown); this.txt_userPassword.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txt_userPassword_KeyDown);
// //
// btn_Login - Steel Blue 主按钮 // btn_Login
// //
this.btn_Login.BackColor = System.Drawing.Color.FromArgb(74, 144, 217); this.btn_Login.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(144)))), ((int)(((byte)(217)))));
this.btn_Login.Cursor = System.Windows.Forms.Cursors.Hand; this.btn_Login.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_Login.FlatAppearance.BorderSize = 0; this.btn_Login.FlatAppearance.BorderSize = 0;
this.btn_Login.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn_Login.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
@@ -120,15 +129,14 @@ namespace MesWork
this.btn_Login.UseVisualStyleBackColor = false; this.btn_Login.UseVisualStyleBackColor = false;
this.btn_Login.Click += new System.EventHandler(this.btn_Login_Click); this.btn_Login.Click += new System.EventHandler(this.btn_Login_Click);
// //
// btn_Cancel - 灰色边框按钮 // btn_Cancel
// //
this.btn_Cancel.BackColor = System.Drawing.Color.White; this.btn_Cancel.BackColor = System.Drawing.Color.White;
this.btn_Cancel.Cursor = System.Windows.Forms.Cursors.Hand; this.btn_Cancel.Cursor = System.Windows.Forms.Cursors.Hand;
this.btn_Cancel.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(209, 213, 219); this.btn_Cancel.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(209)))), ((int)(((byte)(213)))), ((int)(((byte)(219)))));
this.btn_Cancel.FlatAppearance.BorderSize = 1;
this.btn_Cancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btn_Cancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btn_Cancel.Font = new System.Drawing.Font("微软雅黑", 12F); this.btn_Cancel.Font = new System.Drawing.Font("微软雅黑", 12F);
this.btn_Cancel.ForeColor = System.Drawing.Color.FromArgb(107, 114, 128); this.btn_Cancel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(107)))), ((int)(((byte)(114)))), ((int)(((byte)(128)))));
this.btn_Cancel.Location = new System.Drawing.Point(210, 280); this.btn_Cancel.Location = new System.Drawing.Point(210, 280);
this.btn_Cancel.Name = "btn_Cancel"; this.btn_Cancel.Name = "btn_Cancel";
this.btn_Cancel.Size = new System.Drawing.Size(150, 42); this.btn_Cancel.Size = new System.Drawing.Size(150, 42);
@@ -140,31 +148,19 @@ namespace MesWork
// lbl_Msg // lbl_Msg
// //
this.lbl_Msg.Font = new System.Drawing.Font("微软雅黑", 9F); this.lbl_Msg.Font = new System.Drawing.Font("微软雅黑", 9F);
this.lbl_Msg.ForeColor = System.Drawing.Color.FromArgb(239, 68, 68); this.lbl_Msg.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(68)))), ((int)(((byte)(68)))));
this.lbl_Msg.Location = new System.Drawing.Point(40, 332); this.lbl_Msg.Location = new System.Drawing.Point(40, 332);
this.lbl_Msg.Name = "lbl_Msg"; this.lbl_Msg.Name = "lbl_Msg";
this.lbl_Msg.Size = new System.Drawing.Size(320, 24); this.lbl_Msg.Size = new System.Drawing.Size(320, 24);
this.lbl_Msg.TabIndex = 8; this.lbl_Msg.TabIndex = 8;
this.lbl_Msg.Visible = false; this.lbl_Msg.Visible = false;
// //
// 添加控件到卡片
//
this.pnl_Card.Controls.Add(this.lbl_Title);
this.pnl_Card.Controls.Add(this.lbl_SubTitle);
this.pnl_Card.Controls.Add(this.lbl_User);
this.pnl_Card.Controls.Add(this.txt_LoginID);
this.pnl_Card.Controls.Add(this.lbl_Pwd);
this.pnl_Card.Controls.Add(this.txt_userPassword);
this.pnl_Card.Controls.Add(this.btn_Login);
this.pnl_Card.Controls.Add(this.btn_Cancel);
this.pnl_Card.Controls.Add(this.lbl_Msg);
//
// Frm_Login // Frm_Login
// //
this.AcceptButton = this.btn_Login; this.AcceptButton = this.btn_Login;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.BackColor = System.Drawing.Color.FromArgb(240, 244, 248); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(244)))), ((int)(((byte)(248)))));
this.ClientSize = new System.Drawing.Size(1024, 720); this.ClientSize = new System.Drawing.Size(1024, 720);
this.Controls.Add(this.pnl_Card); this.Controls.Add(this.pnl_Card);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
@@ -174,6 +170,7 @@ namespace MesWork
this.pnl_Card.ResumeLayout(false); this.pnl_Card.ResumeLayout(false);
this.pnl_Card.PerformLayout(); this.pnl_Card.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion

View File

@@ -152,6 +152,8 @@ namespace MesWork
MesWorkForm.Curr_UserPassWord = txt_userPassword.Text; MesWorkForm.Curr_UserPassWord = txt_userPassword.Text;
MesWorkForm.Curr_UserName = name; MesWorkForm.Curr_UserName = name;
B_DB_Opera.LoginState_Save(MesWorkForm.Curr_LoginID, MesWorkForm.Curr_UserName, perm);
// 记录登录日志 // 记录登录日志
try { B_DB_Opera.SaveLog_Request(MesWorkForm.Curr_Station, Log_Type.ZK_Login, "", Log_FromAndTo.ZK, Log_FromAndTo.ZK, $"用户[{name}({txt_LoginID.Text.Trim()})]登录系统", out long _); } catch { } try { B_DB_Opera.SaveLog_Request(MesWorkForm.Curr_Station, Log_Type.ZK_Login, "", Log_FromAndTo.ZK, Log_FromAndTo.ZK, $"用户[{name}({txt_LoginID.Text.Trim()})]登录系统", out long _); } catch { }

View File

@@ -1,5 +1,64 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <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: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:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">

View File

@@ -16,6 +16,58 @@ namespace MesWork
{ {
public static bool LoginState_Query(out LoginStateInfo loginState)
{
loginState = null;
try
{
var sqlParameter = new SqlParameter[] {
new SqlParameter("@机器名", Environment.MachineName)
};
SqlOperation.ExecuteStoredProcedure("系统登录状态_查询", sqlParameter, out DataTable dt, out string err);
if (dt != null && dt.Rows.Count > 0 && dt.Rows[0]["result"].ToString() == "1")
{
loginState = new LoginStateInfo
{
LoginID = dt.Rows[0]["登录账号"]?.ToString() ?? "",
UserName = dt.Rows[0]["用户姓名"]?.ToString() ?? "",
Permission = dt.Rows[0]["权限"]?.ToString() ?? ""
};
return !string.IsNullOrWhiteSpace(loginState.LoginID) && !string.IsNullOrWhiteSpace(loginState.UserName);
}
}
catch { }
return false;
}
public static void LoginState_Save(string loginID, string userName, string permission)
{
try
{
var sqlParameter = new SqlParameter[] {
new SqlParameter("@机器名", Environment.MachineName),
new SqlParameter("@登录账号", loginID ?? ""),
new SqlParameter("@用户姓名", userName ?? ""),
new SqlParameter("@权限", permission ?? "")
};
SqlOperation.ExecuteStoredProcedure("系统登录状态_保存", sqlParameter, out string err);
}
catch { }
}
public static void LoginState_Clear()
{
try
{
var sqlParameter = new SqlParameter[] {
new SqlParameter("@机器名", Environment.MachineName)
};
SqlOperation.ExecuteStoredProcedure("系统登录状态_清空", sqlParameter, out string err);
}
catch { }
}
public static void Event_Signal_Log(string opName, int tagTypeCodeID, string signalName, string value) public static void Event_Signal_Log(string opName, int tagTypeCodeID, string signalName, string value)
{ {
var procedureName = "Event_Signal_Log"; var procedureName = "Event_Signal_Log";
@@ -449,6 +501,13 @@ namespace MesWork
} }
public class LoginStateInfo
{
public string LoginID;
public string UserName;
public string Permission;
}
/// <summary> /// <summary>
/// 曲线采样点数据结构 /// 曲线采样点数据结构
/// </summary> /// </summary>

View File

@@ -21,9 +21,16 @@ namespace MesWork
public MesWorkForm() public MesWorkForm()
{ {
Frm_Login frm_Login = new Frm_Login(); if (!TryAutoLogin())
if (frm_Login.ShowDialog() == DialogResult.OK)
{ {
Frm_Login frm_Login = new Frm_Login();
if (frm_Login.ShowDialog() != DialogResult.OK)
{
Process.GetCurrentProcess().Kill();
return;
}
}
OnStart(); OnStart();
InitializeComponent(); InitializeComponent();
@@ -68,10 +75,15 @@ namespace MesWork
// 默认选中"称重作业" // 默认选中"称重作业"
SetActiveNav(pnl_NavWeighing); SetActiveNav(pnl_NavWeighing);
} }
else
private bool TryAutoLogin()
{ {
Process.GetCurrentProcess().Kill(); if (!B_DB_Opera.LoginState_Query(out LoginStateInfo loginState)) return false;
}
Curr_LoginID = loginState.LoginID;
Curr_UserName = loginState.UserName;
Curr_UserPassWord = "";
return true;
} }
// ==================================================================== // ====================================================================
@@ -324,6 +336,7 @@ namespace MesWork
BarcodeManager.Shutdown(); BarcodeManager.Shutdown();
B_DB_Opera.SaveLog_Request(Curr_Station, Log_Type.ZK_Login, "", Log_FromAndTo.ZK, Log_FromAndTo.ZK, $"用户[{Curr_UserName}({Curr_LoginID})]退出称重系统", out long AID); B_DB_Opera.SaveLog_Request(Curr_Station, Log_Type.ZK_Login, "", Log_FromAndTo.ZK, Log_FromAndTo.ZK, $"用户[{Curr_UserName}({Curr_LoginID})]退出称重系统", out long AID);
B_DB_Opera.LoginState_Clear();
Process.GetCurrentProcess().Kill(); Process.GetCurrentProcess().Kill();
} }
} }