|
|
@@ -13,6 +13,7 @@ using UAS_LabelMachine.PublicForm;
|
|
|
using System.Threading;
|
|
|
using System.IO;
|
|
|
using System.Globalization;
|
|
|
+using FastReport;
|
|
|
|
|
|
namespace UAS_LabelMachine
|
|
|
{
|
|
|
@@ -33,15 +34,15 @@ namespace UAS_LabelMachine
|
|
|
/// <summary>
|
|
|
/// 单盘打印文件
|
|
|
/// </summary>
|
|
|
- Document SingleDoc;
|
|
|
+ Report SingleReport = new Report();
|
|
|
/// <summary>
|
|
|
/// 中盒打印文件
|
|
|
/// </summary>
|
|
|
- Document MidDoc;
|
|
|
+ Report MidReport = new Report();
|
|
|
/// <summary>
|
|
|
/// 外箱打印文件
|
|
|
/// </summary>
|
|
|
- Document OutBoxDoc;
|
|
|
+ Report OutReport = new Report();
|
|
|
/// <summary>
|
|
|
/// 唛头文件
|
|
|
/// </summary>
|
|
|
@@ -61,10 +62,6 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
bool logout = false;
|
|
|
|
|
|
- DataTable SingleLabelParam;
|
|
|
- DataTable MidLabelParam;
|
|
|
- DataTable OutLabelParam;
|
|
|
-
|
|
|
//主表数据源
|
|
|
DataTable LabelInfDataTable;
|
|
|
/// <summary>
|
|
|
@@ -117,12 +114,6 @@ namespace UAS_LabelMachine
|
|
|
int NumLength = 0;
|
|
|
int Radix = 0;
|
|
|
|
|
|
- string SingleSQL = "";
|
|
|
-
|
|
|
- string MidSQL = "";
|
|
|
-
|
|
|
- string OutSQL = "";
|
|
|
-
|
|
|
private bool EnablePrint = true;
|
|
|
|
|
|
string[] PIBID;
|
|
|
@@ -204,12 +195,6 @@ 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;
|
|
|
@@ -437,37 +422,17 @@ 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(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();
|
|
|
+ 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();
|
|
|
Properties.Settings.Default.SPrinter = SingleLabelPrinter.Text;
|
|
|
Properties.Settings.Default.Save();
|
|
|
}
|
|
|
@@ -506,8 +471,6 @@ 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++)
|
|
|
{
|
|
|
@@ -520,37 +483,9 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
if (SingleLabelCombox.Text != "")
|
|
|
{
|
|
|
- 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);
|
|
|
+ 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);
|
|
|
}
|
|
|
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 ");
|
|
|
@@ -560,8 +495,6 @@ 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++)
|
|
|
{
|
|
|
@@ -574,37 +507,8 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
if (MidLabelCombox.Text != "")
|
|
|
{
|
|
|
- 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);
|
|
|
+ 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");
|
|
|
}
|
|
|
//缓存中盒参数
|
|
|
sql.Clear();
|
|
|
@@ -615,8 +519,6 @@ 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++)
|
|
|
{
|
|
|
@@ -629,37 +531,9 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
if (OutBoxCombox.Text != "")
|
|
|
{
|
|
|
- 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);
|
|
|
+ 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);
|
|
|
}
|
|
|
if (!File.Exists(ftpOperater.DownLoadTo + "唛头.lab"))
|
|
|
{
|
|
|
@@ -730,20 +604,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (EnablePrint)
|
|
|
{
|
|
|
- try
|
|
|
- {
|
|
|
- if (SingleDoc.Variables.FreeVariables.Count == 0)
|
|
|
- {
|
|
|
- MessageBox.Show("单盘标签未维护参数", "提示");
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
- MessageBox.Show("单盘标签未维护参数", "提示");
|
|
|
- return;
|
|
|
- }
|
|
|
- if (SingleLabelParam.Rows.Count > 0 && LabelInf.Rows.Count > 0)
|
|
|
+ if (LabelInf.Rows.Count > 0)
|
|
|
{
|
|
|
//每次打印清除之前缓存的行号和ID,后面会判断需要打印的数据重新加载
|
|
|
MidIDAndOutboxcode.Clear();
|
|
|
@@ -795,18 +656,13 @@ namespace UAS_LabelMachine
|
|
|
try
|
|
|
{
|
|
|
string pib_id = LabelInf.Rows[i].Cells["pib_id1"].Value.ToString();
|
|
|
- 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());
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select * from prodiobarcode where pib_id=" + pib_id, "select");
|
|
|
+ SingleReport.RegisterData(dt, "Prodiobarcode");
|
|
|
+ SingleReport.GetDataSource("Prodiobarcode").Enabled = true;
|
|
|
//保存参数打印
|
|
|
- SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
- SingleDoc.PrintDocument();
|
|
|
+ SingleReport.PrintSettings.ShowDialog = false;
|
|
|
+ SingleReport.PrintSettings.Printer = SingleLabelPrinter.Text;
|
|
|
+ SingleReport.Print();
|
|
|
Properties.Settings.Default.SPrinter = SingleLabelPrinter.Text;
|
|
|
Properties.Settings.Default.Save();
|
|
|
LabelInf.Rows[i].Cells["pib_ifprint"].Value = true;
|
|
|
@@ -1056,21 +912,14 @@ namespace UAS_LabelMachine
|
|
|
if (EnablePrint)
|
|
|
{
|
|
|
string[] arg = MidBoxArgument.ToArray();
|
|
|
- //将维护的模板参数和模板本身的参数名称进行比对
|
|
|
- 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();
|
|
|
+ //名称相等的时候,取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();
|
|
|
Properties.Settings.Default.MPrinter = MidLabelPrinter.Text;
|
|
|
Properties.Settings.Default.Save();
|
|
|
}
|
|
|
@@ -1080,22 +929,13 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (EnablePrint)
|
|
|
{
|
|
|
- //将维护的模板参数和模板本身的参数名称进行比对
|
|
|
- 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();
|
|
|
+ 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();
|
|
|
Properties.Settings.Default.MPrinter = MidLabelPrinter.Text;
|
|
|
Properties.Settings.Default.Save();
|
|
|
}
|
|
|
@@ -1113,20 +953,14 @@ 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(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);
|
|
|
- }
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select * from prodiobarcode where pib_id=" + pib_id, "select");
|
|
|
+ MidReport.RegisterData(dt, "Prodiobarcode");
|
|
|
+ MidReport.GetDataSource("Prodiobarcode").Enabled = true;
|
|
|
//保存参数打印
|
|
|
- OutBoxDoc.Printer.SwitchTo(OutBoxPrinter.Text);
|
|
|
- OutBoxDoc.PrintDocument();
|
|
|
+ OutReport.PrintSettings.Printer = OutBoxPrinter.Text;
|
|
|
+ OutReport.Print();
|
|
|
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, "提示"); }
|
|
|
@@ -1273,13 +1107,7 @@ 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) { }
|
|
|
@@ -1296,13 +1124,7 @@ 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) { }
|
|
|
@@ -1319,13 +1141,7 @@ 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) { }
|