LL18-25070103,增加上工站过站检测

This commit is contained in:
jfp
2025-07-01 14:46:35 +08:00
parent b2379cd874
commit 50c772abec
7 changed files with 113 additions and 54 deletions

View File

@@ -374,7 +374,7 @@
this.label36.Font = new System.Drawing.Font("宋体", 12F);
this.label36.Location = new System.Drawing.Point(162, 326);
this.label36.Name = "label36";
this.label36.Size = new System.Drawing.Size(71, 16);
this.label36.Size = new System.Drawing.Size(72, 16);
this.label36.TabIndex = 89;
this.label36.Text = "测试进度";
//
@@ -384,7 +384,7 @@
this.Manual.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold);
this.Manual.Location = new System.Drawing.Point(777, 5);
this.Manual.Name = "Manual";
this.Manual.Size = new System.Drawing.Size(16, 16);
this.Manual.Size = new System.Drawing.Size(17, 16);
this.Manual.TabIndex = 63;
this.Manual.TabStop = true;
this.Manual.Text = "?";
@@ -574,6 +574,7 @@
this.Code.TabIndex = 51;
this.Code.TextAlignChanged += new System.EventHandler(this.Code_TextAlignChanged);
this.Code.TextChanged += new System.EventHandler(this.Code_TextChanged);
this.Code.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Code_KeyDown);
//
// menuStrip1
//
@@ -589,7 +590,7 @@
this.ToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1025, 25);
this.menuStrip1.Size = new System.Drawing.Size(1021, 25);
this.menuStrip1.TabIndex = 126;
this.menuStrip1.Text = "menuStrip1";
this.menuStrip1.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.menuStrip1_ItemClicked);
@@ -641,7 +642,6 @@
this.mESSetToolStripMenuItem.Name = "mESSetToolStripMenuItem";
this.mESSetToolStripMenuItem.Size = new System.Drawing.Size(70, 21);
this.mESSetToolStripMenuItem.Text = "MES设置";
this.mESSetToolStripMenuItem.Visible = false;
this.mESSetToolStripMenuItem.Click += new System.EventHandler(this.mESSetToolStripMenuItem_Click);
//
// 注销登录ToolStripMenuItem
@@ -768,7 +768,7 @@
this.label9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label9.Location = new System.Drawing.Point(872, 50);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(87, 16);
this.label9.Size = new System.Drawing.Size(88, 16);
this.label9.TabIndex = 143;
this.label9.Text = "条形码长度";
//
@@ -778,7 +778,7 @@
this.Scancode.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Scancode.Location = new System.Drawing.Point(1596, 57);
this.Scancode.Name = "Scancode";
this.Scancode.Size = new System.Drawing.Size(90, 20);
this.Scancode.Size = new System.Drawing.Size(91, 20);
this.Scancode.TabIndex = 144;
this.Scancode.Text = "扫码启动";
this.Scancode.UseVisualStyleBackColor = true;
@@ -816,7 +816,7 @@
this.Passzong.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Passzong.Location = new System.Drawing.Point(84, 99);
this.Passzong.Name = "Passzong";
this.Passzong.Size = new System.Drawing.Size(23, 16);
this.Passzong.Size = new System.Drawing.Size(24, 16);
this.Passzong.TabIndex = 3;
this.Passzong.Text = "10";
//
@@ -836,7 +836,7 @@
this.Sunzong.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Sunzong.Location = new System.Drawing.Point(84, 49);
this.Sunzong.Name = "Sunzong";
this.Sunzong.Size = new System.Drawing.Size(23, 16);
this.Sunzong.Size = new System.Drawing.Size(24, 16);
this.Sunzong.TabIndex = 1;
this.Sunzong.Text = "10";
this.Sunzong.Click += new System.EventHandler(this.label29_Click);
@@ -1702,7 +1702,7 @@
this.label3.Font = new System.Drawing.Font("宋体", 12F);
this.label3.Location = new System.Drawing.Point(25, 79);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(87, 16);
this.label3.Size = new System.Drawing.Size(88, 16);
this.label3.TabIndex = 61;
this.label3.Text = "串口状态:";
//
@@ -1734,7 +1734,7 @@
this.label1.Font = new System.Drawing.Font("宋体", 12F);
this.label1.Location = new System.Drawing.Point(37, 32);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(63, 16);
this.label1.Size = new System.Drawing.Size(64, 16);
this.label1.TabIndex = 8;
this.label1.Text = "端口号:";
//
@@ -1752,7 +1752,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1025, 675);
this.ClientSize = new System.Drawing.Size(1021, 675);
this.Controls.Add(this.checkCodeRepeat);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label50);
@@ -1810,7 +1810,7 @@
this.Controls.Add(this.groupBox1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1";
this.Text = "LL18-25063001";
this.Text = "LL18-25070103";
this.Activated += new System.EventHandler(this.Form1_Activated);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
this.Load += new System.EventHandler(this.Form1_Load);

View File

@@ -22,6 +22,7 @@ using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
using System.Runtime.InteropServices;
using DHDMesApi;
using DHDMesApi.Data;
using DHDMesApi.Proof;
namespace C_Windows_1
{
@@ -75,6 +76,7 @@ namespace C_Windows_1
public string processNumber = ""; //工序号
public string tester = ""; //测试员
public string machineNumber = ""; //测试设备编号
public string stationName = ""; //上工站名称
public Form1()
{
f1 = this;
@@ -1722,19 +1724,10 @@ namespace C_Windows_1
//启动仪器
private void BtnStart_Click(object sender, EventArgs e)
{
bool bStart = true;
try
{
//检测设备是否已过站
if (checkBox2.Checked)
{
bStart = MesCheck(Code.Text);
}
if (bStart)
{
workstation = (int)yiqi.start;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
@@ -2064,13 +2057,13 @@ namespace C_Windows_1
// string basePath = string.IsNullOrEmpty(path.Text) ? Environment.GetFolderPath(Environment.SpecialFolder.Desktop) : path.Text; //桌面
string basePath = string.IsNullOrEmpty(path.Text) ? Application.StartupPath : path.Text;
string logDirectory = Path.Combine(basePath, "MES");
Directory.CreateDirectory(logDirectory);
//string logDirectory = Path.Combine(basePath, "MES");
Directory.CreateDirectory(basePath);
// 文件名
string fileName = $"{CODE}_{DateTime.Now:yyMMdd_HHmmss}.";
fileName += iType == 0 ? "ini" : "txt";
string fullPath = Path.Combine(logDirectory, fileName);
string fullPath = Path.Combine(basePath, fileName);
string testResult = Tlight.Text;
if(string.IsNullOrEmpty(testResult.Trim()))
@@ -2101,7 +2094,7 @@ namespace C_Windows_1
iniContent.AppendLine($"result={testResult}");//#Pass or Fail
// 7. 写入文件
File.WriteAllText(fullPath, iniContent.ToString(), Encoding.UTF8);
File.WriteAllText(fullPath, iniContent.ToString(), Encoding.GetEncoding("GB2312"));
}
catch (Exception ex)
{
@@ -2819,6 +2812,11 @@ namespace C_Windows_1
{
strURL = regVal.ToString();
}
regVal = regName.GetValue("stationName");
if (regVal != null)
{
stationName = regVal.ToString();
}
regName.Close();
}
@@ -3253,6 +3251,7 @@ namespace C_Windows_1
mes.lineNumber.Text = lineNumber;
mes.tester.Text = tester;
mes.URL.Text = strURL;
mes.textStation.Text = stationName;
OpenForm(mes);
}
@@ -3277,6 +3276,18 @@ namespace C_Windows_1
return returnBytes;
}
private void Code_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
//检测设备是否已过站
if (checkBox2.Checked)
{
MesCheck(Code.Text);
}
}
}
//过站检测
private bool MesCheck(string sCode)
{
@@ -3284,22 +3295,35 @@ namespace C_Windows_1
// tester + "@" + machineNumber + "@" + sCode;
//string sResponse = MESInfo.HttpPost(strURL, sData);
string sResponse = "";
textBox3.Text = "";
int nRet = 0;
try
{
sResponse = DHDMes_IFLYTEK_Data.GetAllData(sCode);
nRet = DHDMes_StationProof.GetProof_BRT(sCode, stationName);
if (nRet == 1)
{
textBox3.Text = "OK";
}
else if (nRet == 0)
{
textBox3.Text = "上工序漏做"; //未过站
MessageBox.Show("上工序漏做");
}
else
{
textBox3.Text = "已过站:" + nRet.ToString();
MessageBox.Show(textBox3.Text);
}
}
catch (Exception e)
{
Console.WriteLine(e);
sResponse = e.Message;
textBox3.Text = e.Message;
MessageBox.Show(e.Message);
}
textBox3.Text = sResponse;
return sResponse.Contains("OK");
return nRet == 1 ? true : false;
}
}
}

View File

@@ -43,27 +43,31 @@
this.label8 = new System.Windows.Forms.Label();
this.lineNumber = new System.Windows.Forms.TextBox();
this.tester = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.textStation = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(270, 112);
this.label1.Location = new System.Drawing.Point(270, 171);
this.label1.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 16);
this.label1.TabIndex = 163;
this.label1.Text = "产线编号";
this.label1.Visible = false;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(270, 176);
this.label2.Location = new System.Drawing.Point(270, 235);
this.label2.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 16);
this.label2.TabIndex = 165;
this.label2.Text = "测试员";
this.label2.Visible = false;
//
// label4
//
@@ -78,7 +82,7 @@
//
// Config
//
this.Config.Location = new System.Drawing.Point(216, 300);
this.Config.Location = new System.Drawing.Point(223, 190);
this.Config.Name = "Config";
this.Config.Size = new System.Drawing.Size(103, 43);
this.Config.TabIndex = 169;
@@ -88,95 +92,123 @@
//
// machineNumber
//
this.machineNumber.Location = new System.Drawing.Point(14, 258);
this.machineNumber.Location = new System.Drawing.Point(14, 317);
this.machineNumber.Margin = new System.Windows.Forms.Padding(5);
this.machineNumber.Name = "machineNumber";
this.machineNumber.Size = new System.Drawing.Size(249, 26);
this.machineNumber.TabIndex = 174;
this.machineNumber.Visible = false;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(11, 237);
this.label5.Location = new System.Drawing.Point(11, 296);
this.label5.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(104, 16);
this.label5.TabIndex = 175;
this.label5.Text = "测试设备编号";
this.label5.Visible = false;
//
// processNumber
//
this.processNumber.Location = new System.Drawing.Point(14, 194);
this.processNumber.Location = new System.Drawing.Point(14, 253);
this.processNumber.Margin = new System.Windows.Forms.Padding(5);
this.processNumber.Name = "processNumber";
this.processNumber.Size = new System.Drawing.Size(249, 26);
this.processNumber.TabIndex = 172;
this.processNumber.Visible = false;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(11, 173);
this.label6.Location = new System.Drawing.Point(11, 232);
this.label6.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(56, 16);
this.label6.TabIndex = 173;
this.label6.Text = "工序号";
this.label6.Visible = false;
//
// productionOrder
//
this.productionOrder.Location = new System.Drawing.Point(14, 133);
this.productionOrder.Location = new System.Drawing.Point(14, 192);
this.productionOrder.Margin = new System.Windows.Forms.Padding(5);
this.productionOrder.Name = "productionOrder";
this.productionOrder.Size = new System.Drawing.Size(249, 26);
this.productionOrder.TabIndex = 170;
this.productionOrder.Visible = false;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(11, 112);
this.label7.Location = new System.Drawing.Point(11, 171);
this.label7.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(72, 16);
this.label7.TabIndex = 171;
this.label7.Text = "生产工单";
this.label7.Visible = false;
//
// URL
//
this.URL.Location = new System.Drawing.Point(14, 72);
this.URL.Location = new System.Drawing.Point(14, 131);
this.URL.Margin = new System.Windows.Forms.Padding(5);
this.URL.Name = "URL";
this.URL.Size = new System.Drawing.Size(506, 26);
this.URL.TabIndex = 176;
this.URL.Visible = false;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(11, 51);
this.label8.Location = new System.Drawing.Point(11, 110);
this.label8.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(32, 16);
this.label8.TabIndex = 177;
this.label8.Text = "URL";
this.label8.Visible = false;
//
// lineNumber
//
this.lineNumber.Location = new System.Drawing.Point(273, 133);
this.lineNumber.Location = new System.Drawing.Point(273, 192);
this.lineNumber.Name = "lineNumber";
this.lineNumber.Size = new System.Drawing.Size(247, 26);
this.lineNumber.TabIndex = 180;
this.lineNumber.Visible = false;
//
// tester
//
this.tester.Location = new System.Drawing.Point(271, 194);
this.tester.Location = new System.Drawing.Point(271, 253);
this.tester.Name = "tester";
this.tester.Size = new System.Drawing.Size(247, 26);
this.tester.TabIndex = 181;
this.tester.Visible = false;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(121, 68);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(64, 16);
this.label3.TabIndex = 182;
this.label3.Text = "上工站:";
//
// textStation
//
this.textStation.Location = new System.Drawing.Point(218, 65);
this.textStation.Name = "textStation";
this.textStation.Size = new System.Drawing.Size(219, 26);
this.textStation.TabIndex = 183;
//
// MESConfig
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(534, 360);
this.ClientSize = new System.Drawing.Size(534, 357);
this.Controls.Add(this.textStation);
this.Controls.Add(this.label3);
this.Controls.Add(this.tester);
this.Controls.Add(this.lineNumber);
this.Controls.Add(this.URL);
@@ -217,5 +249,7 @@
private System.Windows.Forms.Label label8;
public System.Windows.Forms.TextBox lineNumber;
public System.Windows.Forms.TextBox tester;
private System.Windows.Forms.Label label3;
public System.Windows.Forms.TextBox textStation;
}
}

View File

@@ -24,6 +24,7 @@ namespace C_Windows_1
Form1.f1.lineNumber = lineNumber.Text;
Form1.f1.tester = tester.Text;
Form1.f1.strURL = URL.Text;
Form1.f1.stationName = textStation.Text;
Set();
this.Close();
@@ -51,6 +52,7 @@ namespace C_Windows_1
regName.SetValue("lineNumber", lineNumber.Text);
regName.SetValue("tester", tester.Text);
regName.SetValue("URL", URL.Text);
regName.SetValue("stationName", textStation.Text);
regName.Close();
}

View File

@@ -1111,9 +1111,8 @@ E:\platform\LL-28_dehuida\C-Windows-1\bin\Debug\System.Security.Cryptography.Xml
E:\platform\LL-28_dehuida\C-Windows-1\bin\Debug\System.Text.Encoding.CodePages.xml
E:\platform\LL-28_dehuida\C-Windows-1\bin\Debug\Newtonsoft.Json.dll
E:\platform\LL-28_dehuida\C-Windows-1\bin\Debug\System.Security.AccessControl.dll
E:\platform\LL-28_dehuida\C-Windows-1\obj\Debug\C-Windows-LL18.csproj.SuggestedBindingRedirects.cache
E:\platform\LL-28_dehuida\C-Windows-1\bin\Debug\System.Buffers.xml
E:\platform\LL-28_dehuida\C-Windows-1\bin\Debug\System.Numerics.Vectors.xml
E:\platform\LL-28_dehuida\C-Windows-1\bin\Debug\System.Runtime.CompilerServices.Unsafe.xml
E:\platform\LL-28_dehuida\C-Windows-1\obj\Debug\C-Window.5B87B986.Up2Date
E:\platform\LL-28_dehuida\C-Windows-1\bin\Debug\Oracle.ManagedDataAccess.dll
E:\platform\LL-28_dehuida\C-Windows-1\bin\Debug\System.Buffers.dll
E:\platform\LL-28_dehuida\C-Windows-1\bin\Debug\System.Numerics.Vectors.dll
E:\platform\LL-28_dehuida\C-Windows-1\bin\Debug\System.Runtime.CompilerServices.Unsafe.dll
E:\platform\LL-28_dehuida\C-Windows-1\obj\Debug\C-Windows-LL18.csproj.CopyComplete