|
|
@@ -138,6 +138,7 @@ namespace UAS_LabelMachine
|
|
|
dh = SystemInf.dh;
|
|
|
adh = SystemInf.adh;
|
|
|
back_adh = SystemInf.back_adh;
|
|
|
+ adh.ExecuteSql("delete from prodiobarcode", "delete");
|
|
|
CheckForIllegalCrossThreadCalls = false;
|
|
|
pi_inoutno.Focus();
|
|
|
|
|
|
@@ -289,7 +290,7 @@ namespace UAS_LabelMachine
|
|
|
int len = port.BytesToRead;
|
|
|
byte[] readBuffer = new byte[len];
|
|
|
port.Read(readBuffer, 0, len); //将数据读入缓存
|
|
|
- string msg = Encoding.ASCII.GetString(readBuffer, 0, len); //获取出入库产品编号
|
|
|
+ string msg = Encoding.ASCII.GetString(readBuffer, 0, len).Replace("\n","").Replace("\r","").Replace("\t",""); //获取出入库产品编号
|
|
|
int pib_pdno = int.Parse(LabelInf.Rows[CurrentRowIndex].Cells["pib_pdno"].Value.ToString());
|
|
|
if (DetailRange.Checked)
|
|
|
{
|
|
|
@@ -1390,7 +1391,7 @@ namespace UAS_LabelMachine
|
|
|
//查询参数名称相同的获取到取值字段
|
|
|
for (int j = 0; j < MidDoc.Variables.FormVariables.Count; j++)
|
|
|
{
|
|
|
- DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
+ DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|
|
|
if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
|
|
|
{
|
|
|
sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
@@ -1400,7 +1401,7 @@ namespace UAS_LabelMachine
|
|
|
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++)
|
|
|
{
|
|
|
- DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
+ DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|
|
|
if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
|
|
|
{
|
|
|
MidDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
@@ -1444,7 +1445,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
if (MidDoc.Variables.FormVariables.Item(j + 1).Value == "")
|
|
|
{
|
|
|
- dr1 = Attach.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
+ dr1 = Attach.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|
|
|
if (dr1.Length > 0)
|
|
|
MidDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
}
|
|
|
@@ -1475,7 +1476,7 @@ namespace UAS_LabelMachine
|
|
|
sql.Clear();
|
|
|
for (int j = 0; j < OutBoxDoc.Variables.FormVariables.Count; j++)
|
|
|
{
|
|
|
- DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
+ DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|
|
|
if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
|
|
|
{
|
|
|
sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
@@ -1487,7 +1488,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
for (int j = 0; j < OutBoxDoc.Variables.FormVariables.Count; j++)
|
|
|
{
|
|
|
- DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
+ DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|
|
|
if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
|
|
|
{
|
|
|
OutBoxDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
@@ -1531,7 +1532,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
if (OutBoxDoc.Variables.FormVariables.Item(j + 1).Value == "")
|
|
|
{
|
|
|
- dr1 = Attach.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
+ dr1 = Attach.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|
|
|
if (dr1.Length > 0)
|
|
|
OutBoxDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
}
|
|
|
@@ -1872,12 +1873,12 @@ namespace UAS_LabelMachine
|
|
|
for (int j = 0; j < LabelInf.Columns.Count; j++)
|
|
|
{
|
|
|
//去除ID列
|
|
|
- if (dt.Columns[i].ColumnName.ToLower().Contains("id") || dt.Columns[i].ColumnName.ToLower() == "pib_barcode" || dt.Columns[i].ColumnName.ToLower() == "pib_pdno" || dt.Columns[i].ColumnName.ToLower() == "pib_ifpick" || dt.Columns[i].ColumnName.ToLower() == "pib_ifprint" || dt.Columns[i].ColumnName.ToLower() == "pib_datecode1" || dt.Columns[i].ColumnName.ToLower() == "pr_vendprodcode")
|
|
|
+ if (dt.Columns[i].ColumnName.Contains("id") || dt.Columns[i].ColumnName == "pib_barcode" || dt.Columns[i].ColumnName == "pib_pdno" || dt.Columns[i].ColumnName == "pib_ifpick" || dt.Columns[i].ColumnName == "pib_ifprint" || dt.Columns[i].ColumnName == "pib_datecode1" || dt.Columns[i].ColumnName == "pr_vendprodcode")
|
|
|
{
|
|
|
dt.Columns.RemoveAt(i);
|
|
|
break;
|
|
|
}
|
|
|
- switch (dt.Columns[i].ColumnName.ToLower())
|
|
|
+ switch (dt.Columns[i].ColumnName)
|
|
|
{
|
|
|
case "pib_lotno":
|
|
|
dt.Columns[i].ColumnName = "批次号";
|
|
|
@@ -1891,7 +1892,7 @@ namespace UAS_LabelMachine
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
- if (dt.Columns[i].ColumnName.ToLower() == LabelInf.Columns[j].DataPropertyName.ToLower())
|
|
|
+ if (dt.Columns[i].ColumnName == LabelInf.Columns[j].DataPropertyName)
|
|
|
{
|
|
|
dt.Columns[i].ColumnName = LabelInf.Columns[j].HeaderText;
|
|
|
break;
|
|
|
@@ -2553,18 +2554,19 @@ namespace UAS_LabelMachine
|
|
|
sql.Clear();
|
|
|
for (int j = 0; j < SingleDoc.Variables.FormVariables.Count; j++)
|
|
|
{
|
|
|
- DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
+ DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|
|
|
if (dr1.Length > 0)
|
|
|
{
|
|
|
- if (dr1[0]["lp_sql"].ToString() == "字符串")
|
|
|
+ if (dr1[0]["lp_valuetype"].ToString() == "字符串")
|
|
|
sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
}
|
|
|
}
|
|
|
sql.Append("1,");
|
|
|
DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_id=" + pib_id, "select");
|
|
|
+ Console.WriteLine("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_id=" + pib_id);
|
|
|
for (int j = 0; j < SingleDoc.Variables.FormVariables.Count; j++)
|
|
|
{
|
|
|
- DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
+ DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|
|
|
if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "SQL值")
|
|
|
{
|
|
|
DataTable dt1 = (DataTable)adh.ExecuteSql(dr1[0]["lp_sql"].ToString().Replace("{1}", pib_id), "select");
|
|
|
@@ -2590,13 +2592,13 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
+ else if (dr1.Length > 0)
|
|
|
{
|
|
|
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() + "'");
|
|
|
+ dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|
|
|
if (dr1.Length > 0)
|
|
|
SingleDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
}
|