LL18-25070103,增加上工站过站检测
This commit is contained in:
@@ -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,18 +1724,9 @@ 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;
|
||||
}
|
||||
workstation = (int)yiqi.start;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user