|
@@ -1,4 +1,5 @@
|
|
|
using DevExpress.Utils.Drawing.Helpers;
|
|
using DevExpress.Utils.Drawing.Helpers;
|
|
|
|
|
+using DevExpress.XtraBars.Docking2010.Views.Widget;
|
|
|
using NPOI.SS.Formula.Functions;
|
|
using NPOI.SS.Formula.Functions;
|
|
|
using Seagull.BarTender.Print;
|
|
using Seagull.BarTender.Print;
|
|
|
using System;
|
|
using System;
|
|
@@ -36,8 +37,6 @@ namespace UAS_MES_NEW.Make
|
|
|
|
|
|
|
|
SerialPort serialPort = new SerialPort();
|
|
SerialPort serialPort = new SerialPort();
|
|
|
StringBuilder receivedData = new StringBuilder();
|
|
StringBuilder receivedData = new StringBuilder();
|
|
|
- DateTime lastReceiveTime = DateTime.Now;
|
|
|
|
|
- readonly object lockObj = new object();
|
|
|
|
|
|
|
|
|
|
private void Make_AirTightnessTest_Load(object sender, EventArgs e)
|
|
private void Make_AirTightnessTest_Load(object sender, EventArgs e)
|
|
|
{
|
|
{
|
|
@@ -184,7 +183,7 @@ namespace UAS_MES_NEW.Make
|
|
|
serialPort.BaudRate = Convert.ToInt32(BaudRate.Text);
|
|
serialPort.BaudRate = Convert.ToInt32(BaudRate.Text);
|
|
|
if (!serialPort.IsOpen) serialPort.Open();
|
|
if (!serialPort.IsOpen) serialPort.Open();
|
|
|
serialPort.WriteLine(workStation);
|
|
serialPort.WriteLine(workStation);
|
|
|
- Serial_DataReceived(null,null);
|
|
|
|
|
|
|
+ //Serial_DataReceived(null,null);
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
@@ -201,46 +200,40 @@ namespace UAS_MES_NEW.Make
|
|
|
}
|
|
}
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
- string resList = serialPort.ReadExisting();
|
|
|
|
|
|
|
+ string resList = serialPort.ReadExisting(); //resList = "/20251014_142742/0K/2#/NULL/30/99/0/12700/0/N/0K";
|
|
|
receivedData.Append(resList);
|
|
receivedData.Append(resList);
|
|
|
|
|
|
|
|
- //resList = "/20251014_142742/0K/2#/NULL/30/99/0/12700/0/N/0K";
|
|
|
|
|
- lock (lockObj)
|
|
|
|
|
|
|
+ string completeData = receivedData.ToString();
|
|
|
|
|
+ string dateString = DateTime.Now.ToString("yyyyMMdd");
|
|
|
|
|
+ string[] records = completeData.Split(new string[] { "/"+ dateString }, StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
|
+ string parseStr = "/" + dateString + records[records.Length - 1].ToString();
|
|
|
|
|
+ if (parseStr.Split('/').Length > 10)
|
|
|
{
|
|
{
|
|
|
- receivedData.Append(resList);
|
|
|
|
|
- lastReceiveTime = DateTime.Now;
|
|
|
|
|
- if(receivedData.Length > 0)
|
|
|
|
|
|
|
+ if (receivedData.ToString().Contains("1#"))
|
|
|
{
|
|
{
|
|
|
- string completeData = receivedData.ToString();
|
|
|
|
|
- this.Invoke(new Action(() =>
|
|
|
|
|
|
|
+ Result.Text = parseStr;
|
|
|
|
|
+ string testRes = LoadTestDetail("L", "1");
|
|
|
|
|
+ CheckPassStation(FirstSN.Text.Trim(), testRes);
|
|
|
|
|
+ if (testRes == "NG")
|
|
|
{
|
|
{
|
|
|
- if (mTestVal == "LWS1")
|
|
|
|
|
- {
|
|
|
|
|
- Result.Text = completeData;
|
|
|
|
|
- CheckPassStation(FirstSN.Text, Result.Text);
|
|
|
|
|
- LoadTestDetail("L", out string testRes);
|
|
|
|
|
- if (testRes == "NG")
|
|
|
|
|
- {
|
|
|
|
|
- Pagination.SelectedIndex = 0;
|
|
|
|
|
- RTxt8.Focus();
|
|
|
|
|
- RTxt8.SelectAll();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if (mTestVal == "LWS2")
|
|
|
|
|
- {
|
|
|
|
|
- Result1.Text = completeData;
|
|
|
|
|
- CheckPassStation(SecondSN.Text, Result1.Text);
|
|
|
|
|
- LoadTestDetail("L", out string testRes);
|
|
|
|
|
- if (testRes == "NG")
|
|
|
|
|
- {
|
|
|
|
|
- Pagination.SelectedIndex = 1;
|
|
|
|
|
- R1Txt8.Focus();
|
|
|
|
|
- R1Txt8.SelectAll();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- receivedData.Clear();
|
|
|
|
|
- }));
|
|
|
|
|
|
|
+ Pagination.SelectedIndex = 0;
|
|
|
|
|
+ RTxt8.Focus();
|
|
|
|
|
+ RTxt8.SelectAll();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (receivedData.ToString().Contains("2#"))
|
|
|
|
|
+ {
|
|
|
|
|
+ Result1.Text = parseStr;
|
|
|
|
|
+ string testRes = LoadTestDetail("L", "2");
|
|
|
|
|
+ CheckPassStation(SecondSN.Text.Trim(), testRes);
|
|
|
|
|
+ if (testRes == "NG")
|
|
|
|
|
+ {
|
|
|
|
|
+ Pagination.SelectedIndex = 1;
|
|
|
|
|
+ R1Txt8.Focus();
|
|
|
|
|
+ R1Txt8.SelectAll();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ receivedData.Clear();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
@@ -251,30 +244,34 @@ namespace UAS_MES_NEW.Make
|
|
|
|
|
|
|
|
private void CheckPassStation(string sn,string res)
|
|
private void CheckPassStation(string sn,string res)
|
|
|
{
|
|
{
|
|
|
|
|
+ List<string> param = new List<string>() { };
|
|
|
|
|
+ string outMsg = "";
|
|
|
|
|
+ param.Add(workOrder.Text.Trim());
|
|
|
|
|
+ param.Add(sn);
|
|
|
|
|
+ param.Add(User.UserSourceCode);
|
|
|
|
|
+ param.Add(res);
|
|
|
|
|
+ param.Add("");
|
|
|
|
|
+ param.Add("");
|
|
|
|
|
+ param.Add("AirTightness");
|
|
|
|
|
+ param.Add("");
|
|
|
|
|
+ param.Add(outMsg);
|
|
|
|
|
+ string[] paramList = param.ToArray();
|
|
|
|
|
+ dh.CallProcedure("cs_insert_testrejects", ref paramList);
|
|
|
|
|
+ if (paramList[8].Substring(0, 2) == "OK")
|
|
|
|
|
+ {
|
|
|
|
|
+ ShowMsg(1, $"序列号{sn}采集成功:测试结果为{res}");
|
|
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oWO, User.UserLineCode, User.UserSourceCode, "气密性测试", "气密性测试过站成功", sn, "");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ dt = (DataTable)dh.ExecuteSql($"SELECT mp_id FROM makeprocess WHERE mp_sncode = '{sn}' AND mp_sourcecode = 'QMX'", "select");
|
|
|
|
|
+ if (dt.Rows.Count > 0) return;
|
|
|
|
|
+
|
|
|
if (LogicHandler.CheckStepSNAndMacode(workOrder.Text, User.UserSourceCode, sn, User.UserCode, out oWO, out oWOId, out oErrMsg))
|
|
if (LogicHandler.CheckStepSNAndMacode(workOrder.Text, User.UserSourceCode, sn, User.UserCode, out oWO, out oWOId, out oErrMsg))
|
|
|
{
|
|
{
|
|
|
if (LogicHandler.SetStepResult(oWO, User.UserSourceCode, sn, "气密性测试", "OK", User.UserCode, out oErrMsg))
|
|
if (LogicHandler.SetStepResult(oWO, User.UserSourceCode, sn, "气密性测试", "OK", User.UserCode, out oErrMsg))
|
|
|
{
|
|
{
|
|
|
- List<string> param = new List<string>() { };
|
|
|
|
|
- string outMsg = "";
|
|
|
|
|
- param.Add(oWO);
|
|
|
|
|
- param.Add(sn);
|
|
|
|
|
- param.Add(User.UserSourceCode);
|
|
|
|
|
- param.Add(res);
|
|
|
|
|
- param.Add("");
|
|
|
|
|
- param.Add("");
|
|
|
|
|
- param.Add("AirTightness");
|
|
|
|
|
- param.Add("");
|
|
|
|
|
- param.Add(outMsg);
|
|
|
|
|
- string[] paramList = param.ToArray();
|
|
|
|
|
- dh.CallProcedure("cs_insert_testrejects", ref paramList);
|
|
|
|
|
- if (paramList[8].Substring(0, 2) == "OK")
|
|
|
|
|
- {
|
|
|
|
|
- ShowMsg(1, $"序列号{sn}采集成功:测试结果为{res}");
|
|
|
|
|
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, oWO, User.UserLineCode, User.UserSourceCode, "气密性测试", "气密性测试过站成功", sn, "");
|
|
|
|
|
|
|
|
|
|
- //LoadTestDetail("C", out string testRes);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ShowMsg(1, $"序列号{sn}过站OK");
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -288,38 +285,77 @@ namespace UAS_MES_NEW.Make
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void LoadTestDetail(string type, out string testRes)
|
|
|
|
|
|
|
+ private string LoadTestDetail(string type, string num)
|
|
|
{
|
|
{
|
|
|
- string detail = Result.Text.Trim();
|
|
|
|
|
|
|
+ string detail,testRes;
|
|
|
if (type == "L")
|
|
if (type == "L")
|
|
|
{
|
|
{
|
|
|
- string[] parts = detail.Split('/');
|
|
|
|
|
- RTxt1.Text = parts[1];
|
|
|
|
|
- RTxt2.Text = parts[2];
|
|
|
|
|
- RTxt3.Text = parts[3];
|
|
|
|
|
- RTxt4.Text = parts[5];
|
|
|
|
|
- RTxt5.Text = parts[6];
|
|
|
|
|
- RTxt6.Text = parts[7];
|
|
|
|
|
- RTxt7.Text = parts[8];
|
|
|
|
|
- RTxt8.Text = parts[9];
|
|
|
|
|
- RTxt9.Text = parts[10];
|
|
|
|
|
- RTxt10.Text = parts[11];
|
|
|
|
|
- testRes = parts[9].ToUpper() == "Y" ? "OK" : "NG";
|
|
|
|
|
|
|
+ if(num == "1")
|
|
|
|
|
+ {
|
|
|
|
|
+ detail = Result.Text.Trim();
|
|
|
|
|
+ string[] parts = detail.Split('/');
|
|
|
|
|
+ RTxt1.Text = parts[1];
|
|
|
|
|
+ RTxt2.Text = parts[2];
|
|
|
|
|
+ RTxt3.Text = parts[3];
|
|
|
|
|
+ RTxt4.Text = parts[5];
|
|
|
|
|
+ RTxt5.Text = parts[6];
|
|
|
|
|
+ RTxt6.Text = parts[7];
|
|
|
|
|
+ RTxt7.Text = parts[8];
|
|
|
|
|
+ RTxt8.Text = parts[9];
|
|
|
|
|
+ RTxt9.Text = parts[10];
|
|
|
|
|
+ RTxt10.Text = parts[11];
|
|
|
|
|
+ testRes = parts[parts.Length - 2].ToUpper() == "Y" ? "OK" : "NG";
|
|
|
|
|
+ return testRes;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ detail = Result1.Text.Trim();
|
|
|
|
|
+ string[] parts = detail.Split('/');
|
|
|
|
|
+ R1Txt1.Text = parts[1];
|
|
|
|
|
+ R1Txt2.Text = parts[2];
|
|
|
|
|
+ R1Txt3.Text = parts[3];
|
|
|
|
|
+ R1Txt4.Text = parts[5];
|
|
|
|
|
+ R1Txt5.Text = parts[6];
|
|
|
|
|
+ R1Txt6.Text = parts[7];
|
|
|
|
|
+ R1Txt7.Text = parts[8];
|
|
|
|
|
+ R1Txt8.Text = parts[9];
|
|
|
|
|
+ R1Txt9.Text = parts[10];
|
|
|
|
|
+ R1Txt10.Text = parts[11];
|
|
|
|
|
+ testRes = parts[parts.Length - 2].ToUpper() == "Y" ? "OK" : "NG";
|
|
|
|
|
+ return testRes;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
else if (type == "C")
|
|
else if (type == "C")
|
|
|
{
|
|
{
|
|
|
- RTxt1.Text = "";
|
|
|
|
|
- RTxt2.Text = "";
|
|
|
|
|
- RTxt3.Text = "";
|
|
|
|
|
- RTxt4.Text = "";
|
|
|
|
|
- RTxt5.Text = "";
|
|
|
|
|
- RTxt6.Text = "";
|
|
|
|
|
- RTxt7.Text = "";
|
|
|
|
|
- RTxt8.Text = "";
|
|
|
|
|
- RTxt9.Text = "";
|
|
|
|
|
- RTxt10.Text = "";
|
|
|
|
|
|
|
+ if(num == "1")
|
|
|
|
|
+ {
|
|
|
|
|
+ RTxt1.Text = "";
|
|
|
|
|
+ RTxt2.Text = "";
|
|
|
|
|
+ RTxt3.Text = "";
|
|
|
|
|
+ RTxt4.Text = "";
|
|
|
|
|
+ RTxt5.Text = "";
|
|
|
|
|
+ RTxt6.Text = "";
|
|
|
|
|
+ RTxt7.Text = "";
|
|
|
|
|
+ RTxt8.Text = "";
|
|
|
|
|
+ RTxt9.Text = "";
|
|
|
|
|
+ RTxt10.Text = "";
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ R1Txt1.Text = "";
|
|
|
|
|
+ R1Txt2.Text = "";
|
|
|
|
|
+ R1Txt3.Text = "";
|
|
|
|
|
+ R1Txt4.Text = "";
|
|
|
|
|
+ R1Txt5.Text = "";
|
|
|
|
|
+ R1Txt6.Text = "";
|
|
|
|
|
+ R1Txt7.Text = "";
|
|
|
|
|
+ R1Txt8.Text = "";
|
|
|
|
|
+ R1Txt9.Text = "";
|
|
|
|
|
+ R1Txt10.Text = "";
|
|
|
|
|
+ }
|
|
|
|
|
+ return "";
|
|
|
}
|
|
}
|
|
|
- testRes = "";
|
|
|
|
|
|
|
+ return "";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void RTxt8_KeyDown(object sender, KeyEventArgs e)
|
|
private void RTxt8_KeyDown(object sender, KeyEventArgs e)
|