|
|
@@ -142,7 +142,7 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
List<string> OutParam = new List<string>();
|
|
|
|
|
|
- DataTable Attach;
|
|
|
+ public static DataTable Attach;
|
|
|
|
|
|
public UAS_出货标签打印(string Master)
|
|
|
{
|
|
|
@@ -643,42 +643,7 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
private void AutoPrintSingleLabel(string pib_id)
|
|
|
{
|
|
|
- StringBuilder sql = new StringBuilder();
|
|
|
- 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 + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
- {
|
|
|
- if (dr1[0]["lp_valuetype"].ToString() == "字符串")
|
|
|
- sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
- }
|
|
|
- }
|
|
|
- sql.Append("1,");
|
|
|
- DataTable dt = (DataTable)sdh.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++)
|
|
|
- {
|
|
|
- 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)sdh.ExecuteSql(dr1[0]["lp_sql"].ToString().Replace("{1}", pib_id), "select");
|
|
|
- if (dt1.Rows.Count > 0)
|
|
|
- {
|
|
|
- SingleDoc.Variables.FormVariables.Item(j + 1).Value = dt1.Rows[0][0].ToString();
|
|
|
- }
|
|
|
- }
|
|
|
- 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 + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
- SingleDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
- }
|
|
|
- }
|
|
|
- SingleDoc.PrintDocument();
|
|
|
+ Print.CodeSoft.SinglePrint(SingleDoc, SingleLabelParam, pib_id);
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_ifprint"].Value = true;
|
|
|
}
|
|
|
|
|
|
@@ -1453,56 +1418,8 @@ namespace UAS_LabelMachine
|
|
|
//获取对应行的pib_id
|
|
|
string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
|
|
|
- sql.Clear();
|
|
|
+ Print.CodeSoft.MidPrint(MidDoc, MidLabelParam, pi_inoutno.Text, pib_id, pib_outboxcode1);
|
|
|
|
|
|
- //查询参数名称相同的获取到取值字段
|
|
|
- for (int j = 0; j < MidDoc.Variables.FormVariables.Count; j++)
|
|
|
- {
|
|
|
- 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() + ",");
|
|
|
- }
|
|
|
- }
|
|
|
- sql.Append("1,");
|
|
|
- DataTable dt = (DataTable)sdh.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 + "'");
|
|
|
- if (dr1.Length == 0)
|
|
|
- dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name.Replace("_1", "") + "'");
|
|
|
- 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();
|
|
|
- }
|
|
|
- //SQL判断多个值的时候
|
|
|
- if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "SQL值")
|
|
|
- {
|
|
|
- DataTable dt1 = (DataTable)sdh.ExecuteSql(dr1[0]["lp_sql"].ToString().Replace("{1}", "'" + pi_inoutno.Text + "'").Replace("{2}", pib_outboxcode1), "select");
|
|
|
- for (int i = 0; i < dt1.Rows.Count; i++)
|
|
|
- {
|
|
|
- for (int k = 0; k < MidDoc.Variables.FormVariables.Count; k++)
|
|
|
- {
|
|
|
- if (i == 0 & MidDoc.Variables.FormVariables.Item(k + 1).Name == dr1[0]["lp_name"].ToString())
|
|
|
- {
|
|
|
- MidDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[0][0].ToString();
|
|
|
- }
|
|
|
- //使用SN开头的参数赋值SN1,SN2,SN3等参数
|
|
|
- if (MidDoc.Variables.FormVariables.Item(k + 1).Name == (dr1[0]["lp_name"].ToString() + "_" + (i + 1)))
|
|
|
- {
|
|
|
- MidDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[i][0].ToString();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (MidDoc.Variables.FormVariables.Item(j + 1).Value == "")
|
|
|
- {
|
|
|
- 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();
|
|
|
- }
|
|
|
- }
|
|
|
- MidDoc.PrintDocument();
|
|
|
}
|
|
|
|
|
|
private void OutBoxCodePrint(int rowindex)
|
|
|
@@ -1510,62 +1427,7 @@ namespace UAS_LabelMachine
|
|
|
//获取对应行的pib_id
|
|
|
string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
string pib_outboxcode2 = LabelInf.Rows[rowindex].Cells["pib_outboxcode2"].Value.ToString();
|
|
|
- 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 + "'");
|
|
|
- if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
|
|
|
- {
|
|
|
- sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
- }
|
|
|
- }
|
|
|
- sql.Append("1,");
|
|
|
- DataTable dt = (DataTable)sdh.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)
|
|
|
- {
|
|
|
- for (int j = 0; j < OutBoxDoc.Variables.FormVariables.Count; j++)
|
|
|
- {
|
|
|
- DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|
|
|
- //多参数命名
|
|
|
- if (dr1.Length == 0)
|
|
|
- dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name.Replace("_1", "") + "'");
|
|
|
- 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();
|
|
|
- }
|
|
|
- //SQL判断多个值的时候
|
|
|
- if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "SQL值")
|
|
|
- {
|
|
|
- DataTable dt1 = (DataTable)sdh.ExecuteSql(dr1[0]["lp_sql"].ToString().Replace("{1}", "'" + pi_inoutno.Text + "'").Replace("{2}", pib_outboxcode2), "select");
|
|
|
- for (int i = 0; i < dt1.Rows.Count; i++)
|
|
|
- {
|
|
|
- for (int k = 0; k < OutBoxDoc.Variables.FormVariables.Count; k++)
|
|
|
- {
|
|
|
- if (i == 0 & OutBoxDoc.Variables.FormVariables.Item(k + 1).Name == dr1[0]["lp_name"].ToString())
|
|
|
- {
|
|
|
- OutBoxDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[0][0].ToString();
|
|
|
- }
|
|
|
- //使用SN开头的参数赋值SN1,SN2,SN3等参数
|
|
|
- if (OutBoxDoc.Variables.FormVariables.Item(k + 1).Name == (dr1[0]["lp_name"].ToString() + "_" + (i + 1)))
|
|
|
- {
|
|
|
- OutBoxDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[i][0].ToString();
|
|
|
- }
|
|
|
- if (dr1[0]["lp_sql"].ToString().Contains("pib_year"))
|
|
|
- {
|
|
|
- string date = dt1.Rows[0][0].ToString();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (OutBoxDoc.Variables.FormVariables.Item(j + 1).Value == "")
|
|
|
- {
|
|
|
- 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();
|
|
|
- }
|
|
|
- }
|
|
|
- OutBoxDoc.PrintDocument();
|
|
|
- }
|
|
|
+ Print.CodeSoft.OutPrint(OutBoxDoc, OutLabelParam, pi_inoutno.Text, pib_id, pib_outboxcode2);
|
|
|
}
|
|
|
|
|
|
private void CleanDetail_Click(object sender, EventArgs e)
|