|
@@ -369,24 +369,28 @@ namespace UAS_LabelMachine
|
|
{
|
|
{
|
|
//用标签本身的变量作为最外层的循环条件去匹配;
|
|
//用标签本身的变量作为最外层的循环条件去匹配;
|
|
string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
|
|
string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
|
|
- StringBuilder ParamLog = new StringBuilder();
|
|
|
|
- sql.Clear();
|
|
|
|
- sql.Append("select * from ");
|
|
|
|
- for (int i = 0; i < SingleLabelParam.Rows.Count; i++)
|
|
|
|
|
|
+ for (int i = 0; i < SingleDoc.Variables.FreeVariables.Count; i++)
|
|
{
|
|
{
|
|
- if (i != SingleLabelParam.Rows.Count - 1)
|
|
|
|
- sql.Append("(" + SingleLabelParam.Rows[i]["lp_sql"].ToString() + "),");
|
|
|
|
- else
|
|
|
|
- sql.Append("(" + SingleLabelParam.Rows[i]["lp_sql"].ToString() + ")");
|
|
|
|
|
|
+ DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(i + 1).Name.ToLower() + "'");
|
|
|
|
+ if (dr1.Length > 0)
|
|
|
|
+ {
|
|
|
|
+ if (i != SingleDoc.Variables.FreeVariables.Count - 1)
|
|
|
|
+ sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
|
+ else
|
|
|
|
+ sql.Append(dr1[0]["lp_sql"].ToString());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString().ToLower().Replace("{pib_id}", pib_id), "select");
|
|
|
|
|
|
+ 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.FreeVariables.Count; i++)
|
|
for (int i = 0; i < SingleDoc.Variables.FreeVariables.Count; i++)
|
|
{
|
|
{
|
|
- if (dt.Columns.Contains(SingleDoc.Variables.FreeVariables.Item(i + 1).Name.ToLower()))
|
|
|
|
- SingleDoc.Variables.FreeVariables.Item(i + 1).Value = dt.Rows[0][SingleDoc.Variables.FreeVariables.Item(i + 1).Name.ToLower()].ToString();
|
|
|
|
|
|
+ DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(i + 1).Name.ToLower() + "'");
|
|
|
|
+ if (dr1.Length > 0)
|
|
|
|
+ {
|
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(i + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
|
+ }
|
|
if (SingleDoc.Variables.FreeVariables.Item(i + 1).Value == "")
|
|
if (SingleDoc.Variables.FreeVariables.Item(i + 1).Value == "")
|
|
{
|
|
{
|
|
- DataRow[] dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(i + 1).Name.ToLower() + "'");
|
|
|
|
|
|
+ dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(i + 1).Name.ToLower() + "'");
|
|
if (dr1.Length > 0)
|
|
if (dr1.Length > 0)
|
|
SingleDoc.Variables.FreeVariables.Item(i + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
SingleDoc.Variables.FreeVariables.Item(i + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
}
|
|
}
|
|
@@ -712,22 +716,26 @@ namespace UAS_LabelMachine
|
|
{
|
|
{
|
|
string pib_id = LabelInf.Rows[i].Cells["pib_id1"].Value.ToString();
|
|
string pib_id = LabelInf.Rows[i].Cells["pib_id1"].Value.ToString();
|
|
sql.Clear();
|
|
sql.Clear();
|
|
- sql.Append("select * from ");
|
|
|
|
- for (int j = 0; j < SingleLabelParam.Rows.Count; j++)
|
|
|
|
|
|
+ for (int j = 0; j < SingleDoc.Variables.FreeVariables.Count; j++)
|
|
{
|
|
{
|
|
- if (j != SingleLabelParam.Rows.Count - 1)
|
|
|
|
- sql.Append("(" + SingleLabelParam.Rows[j]["lp_sql"].ToString() + "),");
|
|
|
|
- else
|
|
|
|
- sql.Append("(" + SingleLabelParam.Rows[j]["lp_sql"].ToString() + ")");
|
|
|
|
|
|
+ DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
|
+ if (dr1.Length > 0)
|
|
|
|
+ {
|
|
|
|
+ if (j != SingleDoc.Variables.FreeVariables.Count - 1)
|
|
|
|
+ sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString().ToLower().Replace("{pib_id}", pib_id), "select");
|
|
|
|
|
|
+ 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.FreeVariables.Count; j++)
|
|
for (int j = 0; j < SingleDoc.Variables.FreeVariables.Count; j++)
|
|
{
|
|
{
|
|
- if (dt.Columns.Contains(SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower()))
|
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0][SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower()].ToString();
|
|
|
|
|
|
+ DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
|
+ if (dr1.Length > 0)
|
|
|
|
+ {
|
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
|
+ }
|
|
if (SingleDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
if (SingleDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
{
|
|
{
|
|
- DataRow[] dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
|
|
|
+ dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
|
|
if (dr1.Length > 0)
|
|
if (dr1.Length > 0)
|
|
SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
}
|
|
}
|
|
@@ -985,25 +993,28 @@ namespace UAS_LabelMachine
|
|
//获取对应行的pib_id
|
|
//获取对应行的pib_id
|
|
string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
|
|
string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
|
|
- sql.Clear();
|
|
|
|
- sql.Append("select * from ");
|
|
|
|
- for (int i = 0; i < MidLabelParam.Rows.Count; i++)
|
|
|
|
|
|
+ for (int j = 0; j < MidDoc.Variables.FreeVariables.Count; j++)
|
|
{
|
|
{
|
|
- if (i != MidLabelParam.Rows.Count - 1)
|
|
|
|
- sql.Append("(" + MidLabelParam.Rows[i]["lp_sql"].ToString() + "),");
|
|
|
|
- else
|
|
|
|
- sql.Append("(" + MidLabelParam.Rows[i]["lp_sql"].ToString() + ")");
|
|
|
|
|
|
+ DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
|
+ if (dr1.Length > 0)
|
|
|
|
+ {
|
|
|
|
+ if (j != MidDoc.Variables.FreeVariables.Count - 1)
|
|
|
|
+ sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString().ToLower().Replace("{pib_id}", pib_id).Replace("{pib_outboxcode1}", pib_outboxcode1), "select");
|
|
|
|
- for (int i = 0; i < MidDoc.Variables.FreeVariables.Count; i++)
|
|
|
|
|
|
+ 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 + "'", "select");
|
|
|
|
+ for (int j = 0; j < MidDoc.Variables.FreeVariables.Count; j++)
|
|
{
|
|
{
|
|
- if (dt.Columns.Contains(MidDoc.Variables.FreeVariables.Item(i + 1).Name.ToLower()))
|
|
|
|
- MidDoc.Variables.FreeVariables.Item(i + 1).Value = dt.Rows[0][MidDoc.Variables.FreeVariables.Item(i + 1).Name.ToLower()].ToString();
|
|
|
|
- if (MidDoc.Variables.FreeVariables.Item(i + 1).Value == "")
|
|
|
|
|
|
+ DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
|
+ if (dr1.Length > 0)
|
|
|
|
+ {
|
|
|
|
+ MidDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
|
+ }
|
|
|
|
+ if (MidDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
{
|
|
{
|
|
- DataRow[] dr1 = Attach.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(i + 1).Name.ToLower() + "'");
|
|
|
|
|
|
+ dr1 = Attach.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
|
|
if (dr1.Length > 0)
|
|
if (dr1.Length > 0)
|
|
- MidDoc.Variables.FreeVariables.Item(i + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
|
|
|
+ MidDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
MidDoc.Printer.SwitchTo(MidLabelPrinter.Text);
|
|
MidDoc.Printer.SwitchTo(MidLabelPrinter.Text);
|
|
@@ -1018,25 +1029,28 @@ namespace UAS_LabelMachine
|
|
//获取对应行的pib_id
|
|
//获取对应行的pib_id
|
|
string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
string pib_outboxcode2 = LabelInf.Rows[rowindex].Cells["pib_outboxcode2"].Value.ToString();
|
|
string pib_outboxcode2 = LabelInf.Rows[rowindex].Cells["pib_outboxcode2"].Value.ToString();
|
|
- sql.Clear();
|
|
|
|
- sql.Append("select * from ");
|
|
|
|
- for (int i = 0; i < OutLabelParam.Rows.Count; i++)
|
|
|
|
|
|
+ for (int j = 0; j < OutBoxDoc.Variables.FreeVariables.Count; j++)
|
|
{
|
|
{
|
|
- if (i != OutLabelParam.Rows.Count - 1)
|
|
|
|
- sql.Append("(" + OutLabelParam.Rows[i]["lp_sql"].ToString() + "),");
|
|
|
|
- else
|
|
|
|
- sql.Append("(" + OutLabelParam.Rows[i]["lp_sql"].ToString() + ")");
|
|
|
|
|
|
+ DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
|
+ if (dr1.Length > 0)
|
|
|
|
+ {
|
|
|
|
+ if (j != OutBoxDoc.Variables.FreeVariables.Count - 1)
|
|
|
|
+ sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString().ToLower().Replace("{pib_id}", pib_id).Replace("{pib_outboxcode2}", pib_outboxcode2), "select");
|
|
|
|
- for (int i = 0; i < OutBoxDoc.Variables.FreeVariables.Count; i++)
|
|
|
|
|
|
+ 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 + "'", "select");
|
|
|
|
+ for (int j = 0; j < OutBoxDoc.Variables.FreeVariables.Count; j++)
|
|
{
|
|
{
|
|
- if (dt.Columns.Contains(OutBoxDoc.Variables.FreeVariables.Item(i + 1).Name.ToLower()))
|
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(i + 1).Value = dt.Rows[0][OutBoxDoc.Variables.FreeVariables.Item(i + 1).Name.ToLower()].ToString();
|
|
|
|
- if (OutBoxDoc.Variables.FreeVariables.Item(i + 1).Value == "")
|
|
|
|
|
|
+ DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
|
+ if (dr1.Length > 0)
|
|
|
|
+ {
|
|
|
|
+ OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
|
+ }
|
|
|
|
+ if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
{
|
|
{
|
|
- DataRow[] dr1 = Attach.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(i + 1).Name.ToLower() + "'");
|
|
|
|
|
|
+ dr1 = Attach.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
|
|
if (dr1.Length > 0)
|
|
if (dr1.Length > 0)
|
|
- OutBoxDoc.Variables.FreeVariables.Item(i + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
|
|
|
+ OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
OutBoxDoc.Printer.SwitchTo(OutBoxPrinter.Text);
|
|
OutBoxDoc.Printer.SwitchTo(OutBoxPrinter.Text);
|
|
@@ -1106,8 +1120,8 @@ namespace UAS_LabelMachine
|
|
{
|
|
{
|
|
sql.Clear();
|
|
sql.Clear();
|
|
sql.Append("select pd_custprodcode,pib_inoutno,pd_custprodspec,nvl(pib_ifrecheck,0)pib_ifrecheck,nvl(pib_ifupload,0)pib_ifupload,nvl(pib_ifmodify,0)pib_ifmodify,pd_pocode,pib_madein,pib_custbarcode,pib_custoutboxcode,pib_id,pib_pdid,pib_piid,pib_pdno,pib_prodcode,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand, pr_vendprodcode,");
|
|
sql.Append("select pd_custprodcode,pib_inoutno,pd_custprodspec,nvl(pib_ifrecheck,0)pib_ifrecheck,nvl(pib_ifupload,0)pib_ifupload,nvl(pib_ifmodify,0)pib_ifmodify,pd_pocode,pib_madein,pib_custbarcode,pib_custoutboxcode,pib_id,pib_pdid,pib_piid,pib_pdno,pib_prodcode,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand, pr_vendprodcode,");
|
|
- sql.Append("pib_lotno,pib_datecode,pib_qty,pr_spec,pr_zxbzs,pr_unit,pib_barcode,pib_outboxcode1,pib_outboxcode2,nvl(pib_ifpick,0)pib_ifpick,nvl(pib_ifprint,0)pib_ifprint");
|
|
|
|
- sql.Append(" from prodiobarcode left join prodiodetail on pib_piid=pd_piid and pd_pdno=pib_pdno and ");
|
|
|
|
|
|
+ sql.Append("pib_lotno,pib_datecode,pib_qty,pr_spec,pi_title,pr_zxbzs,pr_unit,pib_barcode,pib_outboxcode1,pib_outboxcode2,nvl(pib_ifpick,0)pib_ifpick,nvl(pib_ifprint,0)pib_ifprint");
|
|
|
|
+ sql.Append(" from prodiobarcode left join prodinout on pib_piid=pi_id left join prodiodetail on pib_piid=pd_piid and pd_pdno=pib_pdno and ");
|
|
sql.Append(" pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join sale on sa_code=pib_ordercode ");
|
|
sql.Append(" pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join sale on sa_code=pib_ordercode ");
|
|
sql.Append("where pib_piid='" + PI_ID + "' order by to_number(pib_outboxcode1),pib_id,pd_prodcode");
|
|
sql.Append("where pib_piid='" + PI_ID + "' order by to_number(pib_outboxcode1),pib_id,pd_prodcode");
|
|
dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
@@ -1132,15 +1146,6 @@ namespace UAS_LabelMachine
|
|
SG_Script = dt.Rows[0]["sg_script"].ToString();
|
|
SG_Script = dt.Rows[0]["sg_script"].ToString();
|
|
reg = new Regex(SG_Script);
|
|
reg = new Regex(SG_Script);
|
|
DataTable dt1 = (DataTable)dh.ExecuteSql("select si_name,si_item,si_expression from scanitem where si_sgid='" + sgid + "' and si_enable<>0", "select");
|
|
DataTable dt1 = (DataTable)dh.ExecuteSql("select si_name,si_item,si_expression from scanitem where si_sgid='" + sgid + "' and si_enable<>0", "select");
|
|
- for (int i = 0; i < dt1.Rows.Count; i++)
|
|
|
|
- {
|
|
|
|
- if (SG_Script.IndexOf(dt1.Rows[i]["si_name"].ToString()) >= 0)
|
|
|
|
- {
|
|
|
|
- Si_Item.Add(SG_Script.IndexOf(dt1.Rows[i]["si_name"].ToString()), dt1.Rows[i]["si_item"].ToString());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //根据索引进行排序
|
|
|
|
- Si_Item = (from entry in Si_Item orderby entry.Key ascending select entry).ToDictionary(pair => pair.Key, pair => pair.Value);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|