|
|
@@ -174,6 +174,11 @@ namespace UAS_LabelMachine
|
|
|
if (dr.Length > 0)
|
|
|
{
|
|
|
FrontendCheck.PortName = dr[0]["COM"].ToString();
|
|
|
+ int sleeptime = 0;
|
|
|
+ if (int.TryParse(dr[0]["DATAWAIT"].ToString(), out sleeptime))
|
|
|
+ {
|
|
|
+ FrontendCheck.SleepTime = sleeptime;
|
|
|
+ }
|
|
|
FrontendCheck.Tag = "FrontendCheck";
|
|
|
FrontendCheck.BaudRate = int.Parse(dr[0]["BaudRate"].ToString());
|
|
|
FrontendCheck.DataReceived += Serial_DataReceived;
|
|
|
@@ -184,6 +189,11 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
BackendCheck.PortName = dr[0]["COM"].ToString();
|
|
|
BackendCheck.Tag = "BackendCheck";
|
|
|
+ int sleeptime = 0;
|
|
|
+ if (int.TryParse(dr[0]["DATAWAIT"].ToString(), out sleeptime))
|
|
|
+ {
|
|
|
+ BackendCheck.SleepTime = sleeptime;
|
|
|
+ }
|
|
|
BackendCheck.BaudRate = int.Parse(dr[0]["BaudRate"].ToString());
|
|
|
BackendCheck.DataReceived += Serial_DataReceived;
|
|
|
BackendCheck.Open();
|
|
|
@@ -204,6 +214,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
string ErrorMsg = "";
|
|
|
SerialPortWithTag port = sender as SerialPortWithTag;
|
|
|
+ Thread.Sleep(port.SleepTime);
|
|
|
int len = port.BytesToRead;
|
|
|
byte[] readBuffer = new byte[len];
|
|
|
port.Read(readBuffer, 0, len); //将数据读入缓存
|
|
|
@@ -220,7 +231,7 @@ namespace UAS_LabelMachine
|
|
|
switch (port.Tag)
|
|
|
{
|
|
|
case "PLC1":
|
|
|
- MessageLog.AppendText(msg, Color.Blue);
|
|
|
+ MessageLog.AppendText(msg + "\n", Color.Blue);
|
|
|
////返回的指令和设备执行的动作对应
|
|
|
//foreach (var item in instruct)
|
|
|
//{
|
|
|
@@ -287,7 +298,7 @@ namespace UAS_LabelMachine
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
LogManager.DoLog(ex.StackTrace);
|
|
|
- MessageBox.Show("接收返回消息异常!具体原因:" + ex.Message, "提示信息");
|
|
|
+ MessageBox.Show("接收返回消息异常!具体原因:" + ex.Message + ex.StackTrace, "提示信息");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -620,11 +631,13 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
ErrorMsg = "";
|
|
|
DataTable dtt = LabelInf.DataSource as DataTable;
|
|
|
+ MessageLog.AppendText(msg + "\n");
|
|
|
string[] msgArr = msg.Split(back_sg_separator.Text.ToCharArray());
|
|
|
//需要校验2项数据,完成校验后此项的值需要为2则表示校验成功
|
|
|
int checkItemCount = 0;
|
|
|
List<string> CheckItem = new List<string>();
|
|
|
string pibid = "";
|
|
|
+ string pibid1 = "";
|
|
|
for (int i = 0; i < msgArr.Length; i++)
|
|
|
{
|
|
|
if (RecheckCuprodcode.Checked)
|
|
|
@@ -640,7 +653,7 @@ namespace UAS_LabelMachine
|
|
|
pibid = adh.getFieldDataByCondition("prodiobarcode", "min(pib_id)", "pib_inoutno='" + pi_inoutno.Text + "' and pd_custprodcode='" + msgArr[i] + "' and pib_ifrecheck=0").ToString();
|
|
|
if (pibid != "")
|
|
|
{
|
|
|
-
|
|
|
+ pibid1 = pibid;
|
|
|
CheckItem.Remove("客户料号");
|
|
|
checkItemCount = checkItemCount + 1;
|
|
|
}
|
|
|
@@ -671,6 +684,7 @@ namespace UAS_LabelMachine
|
|
|
pibid = adh.getFieldDataByCondition("prodiobarcode", "min(pib_id)", "pib_inoutno='" + pi_inoutno.Text + "' and pib_custbarcode='" + msgArr[i] + "' and pib_ifrecheck=0").ToString();
|
|
|
if (pibid != "")
|
|
|
{
|
|
|
+ pibid1 = pibid;
|
|
|
CheckItem.Remove("唯一条码");
|
|
|
checkItemCount = checkItemCount + 1;
|
|
|
}
|
|
|
@@ -693,12 +707,12 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- DataRow[] dr = LabelInfDataTable.Select("pib_id=" + pibid);
|
|
|
+ DataRow[] dr = LabelInfDataTable.Select("pib_id=" + pibid1);
|
|
|
if (dr.Length > 0)
|
|
|
{
|
|
|
dr[0]["pib_ifrecheck"] = -1;
|
|
|
}
|
|
|
- adh.ExecuteSql("update prodiobarcode set pib_ifrecheck=-1 where pib_id=" + pibid, "update");
|
|
|
+ adh.ExecuteSql("update prodiobarcode set pib_ifrecheck=-1 where pib_id=" + pibid1, "update");
|
|
|
}
|
|
|
LabelInf.Invalidate();
|
|
|
RefreshProcessData();
|
|
|
@@ -2162,5 +2176,10 @@ namespace UAS_LabelMachine
|
|
|
PageSize = int.Parse(PageSizeNum.Value.ToString());
|
|
|
LoadGridData();
|
|
|
}
|
|
|
+
|
|
|
+ private void button1_Click(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ adh.ExecuteSql("delete from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "'", "delete");
|
|
|
+ }
|
|
|
}
|
|
|
}
|