|
@@ -747,25 +747,29 @@ namespace UAS_LabelMachine
|
|
|
sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
}
|
|
|
}
|
|
|
- DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_id=" + pib_id, "select");
|
|
|
- for (int i = 0; i < SingleDoc.Variables.FormVariables.Count; i++)
|
|
|
+ if (sql.Length != 0)
|
|
|
{
|
|
|
- DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(i + 1).Name.ToLower() + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
- {
|
|
|
- SingleDoc.Variables.FormVariables.Item(i + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
- }
|
|
|
- if (SingleDoc.Variables.FormVariables.Item(i + 1).Value == "")
|
|
|
+ DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_id=" + pib_id, "select");
|
|
|
+ for (int i = 0; i < SingleDoc.Variables.FormVariables.Count; i++)
|
|
|
{
|
|
|
- dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(i + 1).Name.ToLower() + "'");
|
|
|
+ DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(i + 1).Name.ToLower() + "'");
|
|
|
if (dr1.Length > 0)
|
|
|
- SingleDoc.Variables.FormVariables.Item(i + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
+ {
|
|
|
+ SingleDoc.Variables.FormVariables.Item(i + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
+ }
|
|
|
+ if (SingleDoc.Variables.FormVariables.Item(i + 1).Value == "")
|
|
|
+ {
|
|
|
+ dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(i + 1).Name.ToLower() + "'");
|
|
|
+ if (dr1.Length > 0)
|
|
|
+ SingleDoc.Variables.FormVariables.Item(i + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
+ }
|
|
|
}
|
|
|
+ SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
+ SingleDoc.PrintDocument();
|
|
|
+ LogicHandler.UpdateRowPrinted(pib_id);
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_ifprint"].Value = true;
|
|
|
}
|
|
|
- SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
- SingleDoc.PrintDocument();
|
|
|
- LogicHandler.UpdateRowPrinted(pib_id);
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_ifprint"].Value = true;
|
|
|
+ else MessageLog.AppendText("未能匹配到单盘标签参数,请检查标签模板\n", Color.Red);
|
|
|
}
|
|
|
|
|
|
//关闭窗口前提示用户确认
|
|
@@ -1051,24 +1055,28 @@ namespace UAS_LabelMachine
|
|
|
sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
}
|
|
|
}
|
|
|
- DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_id=" + pib_id, "select");
|
|
|
- for (int j = 0; j < SingleDoc.Variables.FormVariables.Count; j++)
|
|
|
+ if (sql.Length != 0)
|
|
|
{
|
|
|
- DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
+ DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_id=" + pib_id, "select");
|
|
|
+ for (int j = 0; j < SingleDoc.Variables.FormVariables.Count; j++)
|
|
|
{
|
|
|
- SingleDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
- }
|
|
|
- if (SingleDoc.Variables.FormVariables.Item(j + 1).Value == "")
|
|
|
- {
|
|
|
- dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
+ DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
if (dr1.Length > 0)
|
|
|
- SingleDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
+ {
|
|
|
+ SingleDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
+ }
|
|
|
+ if (SingleDoc.Variables.FormVariables.Item(j + 1).Value == "")
|
|
|
+ {
|
|
|
+ dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
+ if (dr1.Length > 0)
|
|
|
+ SingleDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
+ }
|
|
|
}
|
|
|
+ SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
+ SingleDoc.PrintDocument();
|
|
|
+ LogicHandler.UpdateRowPrinted(pib_id);
|
|
|
}
|
|
|
- SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
- SingleDoc.PrintDocument();
|
|
|
- LogicHandler.UpdateRowPrinted(pib_id);
|
|
|
+ else MessageLog.AppendText("未能匹配到单盘标签参数,请检查标签模板\n", Color.Red);
|
|
|
if (MidLabelAutoPrint.Checked)
|
|
|
{
|
|
|
//判断当前行的盒号和下一行不相等或者已经是最后一行了
|
|
@@ -1332,23 +1340,27 @@ namespace UAS_LabelMachine
|
|
|
sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
}
|
|
|
}
|
|
|
- DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + (pib_outboxcode1 == "" ? "0" : pib_outboxcode1), "select");
|
|
|
- for (int j = 0; j < MidDoc.Variables.FormVariables.Count; j++)
|
|
|
+ if (sql.Length != 0)
|
|
|
{
|
|
|
- DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
+ DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + (pib_outboxcode1 == "" ? "0" : pib_outboxcode1), "select");
|
|
|
+ for (int j = 0; j < MidDoc.Variables.FormVariables.Count; j++)
|
|
|
{
|
|
|
- MidDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
- }
|
|
|
- if (MidDoc.Variables.FormVariables.Item(j + 1).Value == "")
|
|
|
- {
|
|
|
- dr1 = Attach.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
+ DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
if (dr1.Length > 0)
|
|
|
- MidDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
+ {
|
|
|
+ MidDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
+ }
|
|
|
+ if (MidDoc.Variables.FormVariables.Item(j + 1).Value == "")
|
|
|
+ {
|
|
|
+ dr1 = Attach.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
+ if (dr1.Length > 0)
|
|
|
+ MidDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
+ }
|
|
|
}
|
|
|
+ MidDoc.Printer.SwitchTo(MidLabelPrinter.Text);
|
|
|
+ MidDoc.PrintDocument();
|
|
|
}
|
|
|
- MidDoc.Printer.SwitchTo(MidLabelPrinter.Text);
|
|
|
- MidDoc.PrintDocument();
|
|
|
+ else MessageLog.AppendText("未能匹配到中盒标签参数,请检查标签模板\n", Color.Red);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1368,6 +1380,10 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
}
|
|
|
+ }
|
|
|
+ if (sql.Length != 0)
|
|
|
+ {
|
|
|
+
|
|
|
}
|
|
|
DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2=" + (pib_outboxcode2 == "" ? "0" : pib_outboxcode2), "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
@@ -1389,6 +1405,7 @@ namespace UAS_LabelMachine
|
|
|
OutBoxDoc.Printer.SwitchTo(OutBoxPrinter.Text);
|
|
|
OutBoxDoc.PrintDocument();
|
|
|
}
|
|
|
+ else MessageLog.AppendText("未能匹配到外箱标签参数,请检查标签模板\n", Color.Red);
|
|
|
}
|
|
|
|
|
|
private void OutBoxLabelPrint_Click(object sender, EventArgs e)
|
|
@@ -1899,12 +1916,21 @@ namespace UAS_LabelMachine
|
|
|
LogicHandler.SendDataToPLC(PLC1, PLCInstruct.DeviceStart);
|
|
|
MessageLog.AppendText("PLC启动成功\n", Color.Blue);
|
|
|
}
|
|
|
+ adh.ExecuteSql("update prodiobarcode set pib_ifpick=0,pib_ifprint=0,pib_ifmodify=0 where pib_ifrecheck=0 and pib_inoutno='" + pi_inoutno.Text + "'", "update");
|
|
|
+ dr = LabelInfDataTable.Select("pib_ifrecheck=0");
|
|
|
+ for (int i = 0; i < dr.Length; i++)
|
|
|
+ {
|
|
|
+ dr[i]["pib_ifpick"] = 0;
|
|
|
+ dr[i]["pib_ifprint"] = 0;
|
|
|
+ dr[i]["pib_ifmodify"] = 0;
|
|
|
+ }
|
|
|
+ LabelInf.Invalidate();
|
|
|
}
|
|
|
|
|
|
private void PLCStop_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
LogicHandler.SendDataToPLC(PLC1, PLCInstruct.DeviceStop);
|
|
|
- MessageLog.AppendText("PLC暂停成功", Color.Blue);
|
|
|
+ MessageLog.AppendText("PLC暂停成功\n", Color.Blue);
|
|
|
}
|
|
|
|
|
|
private void ButtonCollectPass_Click(object sender, EventArgs e)
|