|
|
@@ -13,7 +13,6 @@ using UAS_LabelMachine.PublicForm;
|
|
|
using System.Threading;
|
|
|
using System.IO;
|
|
|
using System.Globalization;
|
|
|
-using FastReport;
|
|
|
|
|
|
namespace UAS_LabelMachine
|
|
|
{
|
|
|
@@ -34,15 +33,15 @@ namespace UAS_LabelMachine
|
|
|
/// <summary>
|
|
|
/// 单盘打印文件
|
|
|
/// </summary>
|
|
|
- Report SingleReport = new Report();
|
|
|
+ Document SingleDoc;
|
|
|
/// <summary>
|
|
|
/// 中盒打印文件
|
|
|
/// </summary>
|
|
|
- Report MidReport = new Report();
|
|
|
+ Document MidDoc;
|
|
|
/// <summary>
|
|
|
/// 外箱打印文件
|
|
|
/// </summary>
|
|
|
- Report OutReport = new Report();
|
|
|
+ Document OutBoxDoc;
|
|
|
/// <summary>
|
|
|
/// 唛头文件
|
|
|
/// </summary>
|
|
|
@@ -62,6 +61,10 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
bool logout = false;
|
|
|
|
|
|
+ DataTable SingleLabelParam;
|
|
|
+ DataTable MidLabelParam;
|
|
|
+ DataTable OutLabelParam;
|
|
|
+
|
|
|
//主表数据源
|
|
|
DataTable LabelInfDataTable;
|
|
|
/// <summary>
|
|
|
@@ -114,6 +117,12 @@ namespace UAS_LabelMachine
|
|
|
int NumLength = 0;
|
|
|
int Radix = 0;
|
|
|
|
|
|
+ string SingleSQL = "";
|
|
|
+
|
|
|
+ string MidSQL = "";
|
|
|
+
|
|
|
+ string OutSQL = "";
|
|
|
+
|
|
|
private bool EnablePrint = true;
|
|
|
|
|
|
string[] PIBID;
|
|
|
@@ -195,6 +204,12 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
客户标签维护 form = new 客户标签维护();
|
|
|
BaseUtil.SetFormCenter(form);
|
|
|
+ if (SingleDoc != null)
|
|
|
+ SingleDoc.Close();
|
|
|
+ if (MidDoc != null)
|
|
|
+ MidDoc.Close();
|
|
|
+ if (OutBoxDoc != null)
|
|
|
+ OutBoxDoc.Close();
|
|
|
if (FootDoc != null)
|
|
|
FootDoc.Close();
|
|
|
form.FormClosed += LabelFormClose;
|
|
|
@@ -422,17 +437,37 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (EnablePrint)
|
|
|
{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (SingleDoc.Variables.FreeVariables.Count == 0)
|
|
|
+ {
|
|
|
+ MessageBox.Show("单盘标签未维护参数", "提示");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ MessageBox.Show("单盘标签未维护参数", "提示");
|
|
|
+ return;
|
|
|
+ }
|
|
|
//用标签本身的变量作为最外层的循环条件去匹配;
|
|
|
string[] arg = SingleBoxArgument.ToArray();
|
|
|
StringBuilder ParamLog = new StringBuilder();
|
|
|
for (int i = 0; i < PIBID.Length; i++)
|
|
|
{
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select * from prodiobarcode where pib_id=" + PIBID[i], "select");
|
|
|
- SingleReport.RegisterData(dt, "Prodiobarcode");
|
|
|
- SingleReport.GetDataSource("Prodiobarcode").Enabled = true;
|
|
|
- SingleReport.PrintSettings.ShowDialog = false;
|
|
|
- SingleReport.PrintSettings.Printer = SingleLabelPrinter.Text;
|
|
|
- SingleReport.Print();
|
|
|
+ //将维护的模板参数和模板本身的参数名称进行比对
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql(SingleSQL.ToLower().Replace("{pib_id}", "'" + PIBID[i] + "'"), "select");
|
|
|
+ for (int k = 0; k < SingleLabelParam.Rows.Count; k++)
|
|
|
+ {
|
|
|
+ string ParamName = SingleLabelParam.Rows[k]["lp_name"].ToString();
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(ParamName).Value = dt.Rows[0][k].ToString();
|
|
|
+ ParamLog.AppendLine("pib_id:" + PIBID[i] + ",SingleDoc打印参数【" + SingleDoc.Variables.FreeVariables.Item(ParamName).Name + "】赋值," + "取到值" + SingleDoc.Variables.FreeVariables.Item(ParamName).Value);
|
|
|
+ }
|
|
|
+ LogManager.DoLog(ParamLog.ToString());
|
|
|
+ //保存参数打印
|
|
|
+ Console.WriteLine(SingleDoc.Database.GetType());
|
|
|
+ SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
+ SingleDoc.PrintDocument();
|
|
|
Properties.Settings.Default.SPrinter = SingleLabelPrinter.Text;
|
|
|
Properties.Settings.Default.Save();
|
|
|
}
|
|
|
@@ -471,6 +506,8 @@ namespace UAS_LabelMachine
|
|
|
SingleLabelCombox.DisplayMember = "cl_labelname";
|
|
|
SingleLabelCombox.ValueMember = "la_id";
|
|
|
SingleLabelCombox.DataSource = dt;
|
|
|
+ if (SingleDoc != null)
|
|
|
+ SingleDoc.Close();
|
|
|
if (!GetGridOnly.Checked)
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
|
@@ -483,9 +520,37 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
if (SingleLabelCombox.Text != "")
|
|
|
{
|
|
|
- SingleReport.Load(@"F:/Simple List.frx");
|
|
|
- //DataTable Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LABELATTACHPARAMETER where lap_custcode='" + pi_cardcode.Text + "' and lap_param in(" + ParamCondition + ")", "select");
|
|
|
- //SingleLabelParam.Merge(Attach);
|
|
|
+ SingleDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + SingleLabelCombox.Text);
|
|
|
+ string ParamCondition = "";
|
|
|
+ for (int i = 0; i < SingleDoc.Variables.FreeVariables.Count; i++)
|
|
|
+ {
|
|
|
+ if (i != SingleDoc.Variables.FreeVariables.Count - 1)
|
|
|
+ {
|
|
|
+ ParamCondition += "'" + SingleDoc.Variables.FreeVariables.Item(i + 1).Name + "',";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ParamCondition += "'" + SingleDoc.Variables.FreeVariables.Item(i + 1).Name + "'";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SingleLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + SingleLabelCombox.SelectedValue.ToString().Split('#')[0] + " and lp_name in(" + ParamCondition + ") order by lp_detno", "select");
|
|
|
+ DataTable Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LABELATTACHPARAMETER where lap_custcode='" + pi_cardcode.Text + "' and lap_param in(" + ParamCondition + ")", "select");
|
|
|
+ SingleSQL = "select * from ";
|
|
|
+ for (int i = 0; i < SingleLabelParam.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ if (i != SingleLabelParam.Rows.Count - 1 || Attach.Rows.Count > 0)
|
|
|
+ SingleSQL += "(" + SingleLabelParam.Rows[i]["lp_sql"].ToString() + "),";
|
|
|
+ else
|
|
|
+ SingleSQL += "(" + SingleLabelParam.Rows[i]["lp_sql"].ToString() + ")";
|
|
|
+ }
|
|
|
+ for (int i = 0; i < Attach.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ if (i != Attach.Rows.Count - 1)
|
|
|
+ SingleSQL += "(select '" + Attach.Rows[i]["lp_sql"].ToString() + "' from dual),";
|
|
|
+ else
|
|
|
+ SingleSQL += "(select '" + Attach.Rows[i]["lp_sql"].ToString() + "' from dual)";
|
|
|
+ }
|
|
|
+ SingleLabelParam.Merge(Attach);
|
|
|
}
|
|
|
sql.Clear();
|
|
|
sql.Append("select to_char(nvl(cl_date,sysdate),'YYYY-MM-DD HH24:Mi:SS') cl_date,cl_labelname,cl_isdefault,la_id||'#'||cl_labelurl||'#'||to_char(cl_date,'YYYY-MM-DD HH24:Mi:SS') la_id,cl_custcode from customerlabel left join prodinout on pi_cardcode=cl_custcode ");
|
|
|
@@ -495,6 +560,8 @@ namespace UAS_LabelMachine
|
|
|
MidLabelCombox.DisplayMember = "cl_labelname";
|
|
|
MidLabelCombox.ValueMember = "la_id";
|
|
|
MidLabelCombox.DataSource = dt;
|
|
|
+ if (MidDoc != null)
|
|
|
+ MidDoc.Close();
|
|
|
if (!GetGridOnly.Checked)
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
|
@@ -507,8 +574,37 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
if (MidLabelCombox.Text != "")
|
|
|
{
|
|
|
- MidReport.Load(@"F:/Simple List.frx");
|
|
|
- //DataTable Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LABELATTACHPARAMETER where lap_custcode='" + pi_cardcode.Text + "' and lap_param in(" + ParamCondition + ")", "select");
|
|
|
+ MidDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + MidLabelCombox.Text);
|
|
|
+ string ParamCondition = "";
|
|
|
+ for (int i = 0; i < MidDoc.Variables.FreeVariables.Count; i++)
|
|
|
+ {
|
|
|
+ if (i != MidDoc.Variables.FreeVariables.Count - 1)
|
|
|
+ {
|
|
|
+ ParamCondition += "'" + MidDoc.Variables.FreeVariables.Item(i + 1).Name + "',";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ParamCondition += "'" + MidDoc.Variables.FreeVariables.Item(i + 1).Name + "'";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ MidLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + MidLabelCombox.SelectedValue.ToString().Split('#')[0] + " and lp_name in(" + ParamCondition + ") order by lp_detno", "select");
|
|
|
+ DataTable Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LABELATTACHPARAMETER where lap_custcode='" + pi_cardcode.Text + "' and lap_param in(" + ParamCondition + ")", "select");
|
|
|
+ MidSQL = "select * from ";
|
|
|
+ for (int i = 0; i < MidLabelParam.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ if (i != MidLabelParam.Rows.Count - 1 || Attach.Rows.Count > 0)
|
|
|
+ MidSQL += "(" + MidLabelParam.Rows[i]["lp_sql"].ToString() + "),";
|
|
|
+ else
|
|
|
+ MidSQL += "(" + MidLabelParam.Rows[i]["lp_sql"].ToString() + ")";
|
|
|
+ }
|
|
|
+ for (int i = 0; i < Attach.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ if (i != Attach.Rows.Count - 1)
|
|
|
+ MidSQL += "(select '" + Attach.Rows[i]["lp_sql"].ToString() + "' from dual),";
|
|
|
+ else
|
|
|
+ MidSQL += "(select '" + Attach.Rows[i]["lp_sql"].ToString() + "' from dual)";
|
|
|
+ }
|
|
|
+ MidLabelParam.Merge(Attach);
|
|
|
}
|
|
|
//缓存中盒参数
|
|
|
sql.Clear();
|
|
|
@@ -519,6 +615,8 @@ namespace UAS_LabelMachine
|
|
|
OutBoxCombox.DisplayMember = "cl_labelname";
|
|
|
OutBoxCombox.ValueMember = "la_id";
|
|
|
OutBoxCombox.DataSource = dt;
|
|
|
+ if (OutBoxDoc != null)
|
|
|
+ OutBoxDoc.Close();
|
|
|
if (!GetGridOnly.Checked)
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
|
@@ -531,9 +629,37 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
if (OutBoxCombox.Text != "")
|
|
|
{
|
|
|
- OutReport.Load(@"F:/Simple List.frx");
|
|
|
- //DataTable Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LABELATTACHPARAMETER where lap_custcode='" + pi_cardcode.Text + "' and lap_param in(" + ParamCondition + ")", "select");
|
|
|
- //OutLabelParam.Merge(Attach);
|
|
|
+ OutBoxDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + OutBoxCombox.Text);
|
|
|
+ string ParamCondition = "";
|
|
|
+ for (int i = 0; i < OutBoxDoc.Variables.FreeVariables.Count; i++)
|
|
|
+ {
|
|
|
+ if (i != OutBoxDoc.Variables.FreeVariables.Count - 1)
|
|
|
+ {
|
|
|
+ ParamCondition += "'" + OutBoxDoc.Variables.FreeVariables.Item(i + 1).Name + "',";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ParamCondition += "'" + OutBoxDoc.Variables.FreeVariables.Item(i + 1).Name + "'";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ OutLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + OutBoxCombox.SelectedValue.ToString().Split('#')[0] + " and lp_name in(" + ParamCondition + ") order by lp_detno", "select");
|
|
|
+ DataTable Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LABELATTACHPARAMETER where lap_custcode='" + pi_cardcode.Text + "' and lap_param in(" + ParamCondition + ")", "select");
|
|
|
+ OutSQL = "select * from ";
|
|
|
+ for (int i = 0; i < OutLabelParam.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ if (i != OutLabelParam.Rows.Count - 1 || Attach.Rows.Count > 0)
|
|
|
+ OutSQL += "(" + OutLabelParam.Rows[i]["lp_sql"].ToString() + "),";
|
|
|
+ else
|
|
|
+ OutSQL += "(" + OutLabelParam.Rows[i]["lp_sql"].ToString() + ")";
|
|
|
+ }
|
|
|
+ for (int i = 0; i < Attach.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ if (i != Attach.Rows.Count - 1)
|
|
|
+ OutSQL += "(select '" + Attach.Rows[i]["lp_sql"].ToString() + "' from dual),";
|
|
|
+ else
|
|
|
+ OutSQL += "(select '" + Attach.Rows[i]["lp_sql"].ToString() + "' from dual)";
|
|
|
+ }
|
|
|
+ OutLabelParam.Merge(Attach);
|
|
|
}
|
|
|
if (!File.Exists(ftpOperater.DownLoadTo + "唛头.lab"))
|
|
|
{
|
|
|
@@ -604,7 +730,20 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (EnablePrint)
|
|
|
{
|
|
|
- if (LabelInf.Rows.Count > 0)
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (SingleDoc.Variables.FreeVariables.Count == 0)
|
|
|
+ {
|
|
|
+ MessageBox.Show("单盘标签未维护参数", "提示");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ MessageBox.Show("单盘标签未维护参数", "提示");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (SingleLabelParam.Rows.Count > 0 && LabelInf.Rows.Count > 0)
|
|
|
{
|
|
|
//每次打印清除之前缓存的行号和ID,后面会判断需要打印的数据重新加载
|
|
|
MidIDAndOutboxcode.Clear();
|
|
|
@@ -656,13 +795,18 @@ namespace UAS_LabelMachine
|
|
|
try
|
|
|
{
|
|
|
string pib_id = LabelInf.Rows[i].Cells["pib_id1"].Value.ToString();
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select * from prodiobarcode where pib_id=" + pib_id, "select");
|
|
|
- SingleReport.RegisterData(dt, "Prodiobarcode");
|
|
|
- SingleReport.GetDataSource("Prodiobarcode").Enabled = true;
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql(SingleSQL.ToLower().Replace("{pib_id}", "'" + pib_id + "'"), "select");
|
|
|
+ StringBuilder ParamLog = new StringBuilder();
|
|
|
+ for (int k = 0; k < SingleLabelParam.Rows.Count; k++)
|
|
|
+ {
|
|
|
+ string ParamName = SingleLabelParam.Rows[k]["lp_name"].ToString();
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(ParamName).Value = dt.Rows[0][k].ToString();
|
|
|
+ ParamLog.AppendLine("pib_id:" + pib_id + ",SingleDoc打印参数【" + SingleDoc.Variables.FreeVariables.Item(ParamName).Name + "】赋值," + "取到值" + SingleDoc.Variables.FreeVariables.Item(ParamName).Value);
|
|
|
+ }
|
|
|
+ LogManager.DoLog(ParamLog.ToString());
|
|
|
//保存参数打印
|
|
|
- SingleReport.PrintSettings.ShowDialog = false;
|
|
|
- SingleReport.PrintSettings.Printer = SingleLabelPrinter.Text;
|
|
|
- SingleReport.Print();
|
|
|
+ SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
+ SingleDoc.PrintDocument();
|
|
|
Properties.Settings.Default.SPrinter = SingleLabelPrinter.Text;
|
|
|
Properties.Settings.Default.Save();
|
|
|
LabelInf.Rows[i].Cells["pib_ifprint"].Value = true;
|
|
|
@@ -912,14 +1056,21 @@ namespace UAS_LabelMachine
|
|
|
if (EnablePrint)
|
|
|
{
|
|
|
string[] arg = MidBoxArgument.ToArray();
|
|
|
- //名称相等的时候,取SQL进行值的查询
|
|
|
- string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
- string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select * from prodiobarcode where pib_id=" + pib_id, "select");
|
|
|
- MidReport.RegisterData(dt, "Prodiobarcode");
|
|
|
- MidReport.GetDataSource("Prodiobarcode").Enabled = true;
|
|
|
- MidReport.PrintSettings.Printer = MidLabelPrinter.Text;
|
|
|
- MidReport.Print();
|
|
|
+ //将维护的模板参数和模板本身的参数名称进行比对
|
|
|
+ for (int k = 0; k < MidLabelParam.Rows.Count; k++)
|
|
|
+ {
|
|
|
+ //名称相等的时候,取SQL进行值的查询
|
|
|
+ string ParamName = MidLabelParam.Rows[k]["lp_name"].ToString();
|
|
|
+ string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
+ string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql(MidSQL.ToLower().Replace("{pib_id}", pib_id).Replace("{pib_outboxcode1}", pib_outboxcode1), "select");
|
|
|
+ //获取打印执行的SQL
|
|
|
+ MidDoc.Variables.FreeVariables.Item(ParamName).Value = dt.Rows[0][k].ToString();
|
|
|
+ LogManager.DoLog("打印参数【" + MidDoc.Variables.FreeVariables.Item(ParamName).Name + "】赋值," + ",取到值" + MidDoc.Variables.FreeVariables.Item(ParamName).Value);
|
|
|
+ }
|
|
|
+ //保存参数打印
|
|
|
+ MidDoc.Printer.SwitchTo(MidLabelPrinter.Text);
|
|
|
+ MidDoc.PrintDocument();
|
|
|
Properties.Settings.Default.MPrinter = MidLabelPrinter.Text;
|
|
|
Properties.Settings.Default.Save();
|
|
|
}
|
|
|
@@ -929,13 +1080,22 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (EnablePrint)
|
|
|
{
|
|
|
- string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
- string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select * from prodiobarcode where pib_id=" + pib_id, "select");
|
|
|
- MidReport.RegisterData(dt, "Prodiobarcode");
|
|
|
- MidReport.GetDataSource("Prodiobarcode").Enabled = true;
|
|
|
- MidReport.PrintSettings.Printer = MidLabelPrinter.Text;
|
|
|
- MidReport.Print();
|
|
|
+ //将维护的模板参数和模板本身的参数名称进行比对
|
|
|
+ for (int k = 0; k < MidLabelParam.Rows.Count; k++)
|
|
|
+ {
|
|
|
+ //名称相等的时候,取SQL进行值的查询
|
|
|
+ string ParamName = MidLabelParam.Rows[k]["lp_name"].ToString();
|
|
|
+ string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
+ string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql(MidSQL.ToLower().Replace("{pib_id}", pib_id).Replace("{pib_outboxcode1}", pib_outboxcode1), "select");
|
|
|
+ //获取打印执行的SQL
|
|
|
+ MidDoc.Variables.FreeVariables.Item(ParamName).Value = dt.Rows[0][k].ToString();
|
|
|
+ LogManager.DoLog("打印参数【" + MidDoc.Variables.FreeVariables.Item(ParamName).Name + "】赋值" + ",取到值" + MidDoc.Variables.FreeVariables.Item(ParamName).Value);
|
|
|
+ }
|
|
|
+ //保存参数打印
|
|
|
+
|
|
|
+ MidDoc.Printer.SwitchTo(MidLabelPrinter.Text);
|
|
|
+ MidDoc.PrintDocument();
|
|
|
Properties.Settings.Default.MPrinter = MidLabelPrinter.Text;
|
|
|
Properties.Settings.Default.Save();
|
|
|
}
|
|
|
@@ -953,14 +1113,20 @@ namespace UAS_LabelMachine
|
|
|
//将维护的模板参数和模板本身的参数名称进行比对
|
|
|
string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
string pib_outboxcode2 = LabelInf.Rows[rowindex].Cells["pib_outboxcode2"].Value.ToString();
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select * from prodiobarcode where pib_id=" + pib_id, "select");
|
|
|
- MidReport.RegisterData(dt, "Prodiobarcode");
|
|
|
- MidReport.GetDataSource("Prodiobarcode").Enabled = true;
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql(OutSQL.ToLower().Replace("{pib_id}", "'" + pib_id + "'").Replace("{pib_outboxcode2}", "'" + pib_outboxcode2 + "'"), "select");
|
|
|
+ for (int k = 0; k < OutLabelParam.Rows.Count; k++)
|
|
|
+ {
|
|
|
+ //获取对应行的pib_id
|
|
|
+ string ParamName = OutLabelParam.Rows[k]["lp_name"].ToString();
|
|
|
+ OutBoxDoc.Variables.FreeVariables.Item(ParamName).Value = dt.Rows[0][k].ToString();
|
|
|
+ LogManager.DoLog("打印参数【" + OutBoxDoc.Variables.FreeVariables.Item(ParamName).Name + "】赋值" + ",取到值" + OutBoxDoc.Variables.FreeVariables.Item(ParamName).Value);
|
|
|
+ }
|
|
|
//保存参数打印
|
|
|
- OutReport.PrintSettings.Printer = OutBoxPrinter.Text;
|
|
|
- OutReport.Print();
|
|
|
+ OutBoxDoc.Printer.SwitchTo(OutBoxPrinter.Text);
|
|
|
+ OutBoxDoc.PrintDocument();
|
|
|
Properties.Settings.Default.OPrinter = OutBoxPrinter.Text;
|
|
|
Properties.Settings.Default.Save();
|
|
|
+ LogManager.DoLog("执行打印外箱,pib_id:" + LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString());
|
|
|
LogManager.DoCommandLog(pi_inoutno.Text, User.UserCode, "手动打印外箱箱标", "打印成功");
|
|
|
}
|
|
|
catch (Exception ex) { MessageBox.Show(ex.Message, "提示"); }
|
|
|
@@ -1107,7 +1273,13 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (ComBoxClickChangeLabelDoc)
|
|
|
{
|
|
|
-
|
|
|
+ if (SingleDoc != null)
|
|
|
+ SingleDoc.Close();
|
|
|
+ if (SingleLabelCombox.Text != "" && SingleLabelCombox.SelectedValue != null && !GetGridOnly.Checked)
|
|
|
+ {
|
|
|
+ System.DateTime time = Convert.ToDateTime(SingleLabelCombox.SelectedValue.ToString().Split('#')[2]);
|
|
|
+ SingleDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(SingleLabelCombox.SelectedValue.ToString().Split('#')[1], SingleLabelCombox.Text, time));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
catch (Exception) { }
|
|
|
@@ -1124,7 +1296,13 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (ComBoxClickChangeLabelDoc)
|
|
|
{
|
|
|
-
|
|
|
+ if (MidDoc != null)
|
|
|
+ MidDoc.Close();
|
|
|
+ if (MidLabelCombox.Text != "" && MidLabelCombox.SelectedValue != null && !GetGridOnly.Checked)
|
|
|
+ {
|
|
|
+ System.DateTime time = Convert.ToDateTime(MidLabelCombox.SelectedValue.ToString().Split('#')[2]);
|
|
|
+ MidDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(MidLabelCombox.SelectedValue.ToString().Split('#')[1], MidLabelCombox.Text, time));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
catch (Exception) { }
|
|
|
@@ -1141,7 +1319,13 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (ComBoxClickChangeLabelDoc)
|
|
|
{
|
|
|
-
|
|
|
+ if (OutBoxDoc != null)
|
|
|
+ OutBoxDoc.Close();
|
|
|
+ if (OutBoxCombox.Text != "" && OutBoxCombox.SelectedValue != null && !GetGridOnly.Checked)
|
|
|
+ {
|
|
|
+ System.DateTime time = Convert.ToDateTime(OutBoxCombox.SelectedValue.ToString().Split('#')[2]);
|
|
|
+ OutBoxDoc = lbl.Documents.Open(BaseUtil.GetLabelUrl(OutBoxCombox.SelectedValue.ToString().Split('#')[1], OutBoxCombox.Text, time));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
catch (Exception) { }
|