|
|
@@ -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>
|
|
|
@@ -73,10 +76,6 @@ namespace UAS_LabelMachine
|
|
|
/// </summary>
|
|
|
List<string> SingleBoxArgument = new List<string>();
|
|
|
/// <summary>
|
|
|
- /// 存放中盒的ID和盒号
|
|
|
- /// </summary>
|
|
|
- Dictionary<string, string> MidIDAndOutboxcode = new Dictionary<string, string>();
|
|
|
- /// <summary>
|
|
|
/// 中盒的打印参数
|
|
|
/// </summary>
|
|
|
List<string> MidBoxArgument = new List<string>();
|
|
|
@@ -114,6 +113,12 @@ namespace UAS_LabelMachine
|
|
|
int NumLength = 0;
|
|
|
int Radix = 0;
|
|
|
|
|
|
+ string SingleSQL = "";
|
|
|
+
|
|
|
+ string MidSQL = "";
|
|
|
+
|
|
|
+ string OutSQL = "";
|
|
|
+
|
|
|
private bool EnablePrint = true;
|
|
|
|
|
|
string[] PIBID;
|
|
|
@@ -195,6 +200,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;
|
|
|
@@ -366,7 +377,7 @@ namespace UAS_LabelMachine
|
|
|
sql.Append("insert into prodiobarcode(PIB_ID,PIB_PRODCODE,PIB_INDATE,PIB_INOUTNO,PIB_PIID,PIB_PDNO, PIB_PDID,PIB_PICLASS,");
|
|
|
sql.Append("PIB_BARCODE,PIB_CUSTBARCODE,PIB_QTY,pib_brand,pib_datecode,pib_lotno,PIB_OUTBOXCODE2,pib_inman,PIB_IFPRINT,PIB_ORDERCODE,PIB_CUSTPO) ");
|
|
|
sql.Append("select :PIB_ID,pd_prodcode,sysdate,pi_inoutno,pi_id,pd_pdno,pd_id,pi_class,");
|
|
|
- sql.Append("'" + pib_barcode + "',:PIB_CUSTBARCODE,'" + CurrentZXBZ + "',pjd_brand,'" + Data["DATECODE"] + "','" + Data["LOTNO"] + "','" + pib_outboxcode2 + "','" + User.UserCode + "','" + (EnablePrint && SingleLabelAutoPrint.Checked ? 1 : 0).ToString() + "',pd_ordercode,pd_pocode ");
|
|
|
+ sql.Append("'" + pib_barcode + "',:PIB_CUSTBARCODE,'" + CurrentZXBZ + "',pjd_brand,'" + Data["DATECODE"] + "','" + Data["LOTNO"] + "','" + pib_outboxcode2 + "','" + User.UserCode + "','" + (EnablePrint ? 1 : 0).ToString() + "',pd_ordercode,pd_pocode ");
|
|
|
sql.Append("from prodinout left join prodiodetail on pi_id=pd_piid left join PRODJOINVENDDETAIL on pjd_brand =pd_brand and pjd_prodcode=pd_prodcode where pi_id='" + PI_ID + "' and pd_prodcode='" + CurrentPrCode + "' and pd_pdno='" + CurrentPDNO + "'");
|
|
|
dh.BatchInsert(sql.ToString(), new string[] { "PIB_ID", "PIB_CUSTBARCODE" }, PIBID, CustBarCode.ToArray());
|
|
|
//更新流水号
|
|
|
@@ -422,17 +433,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 +502,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 +516,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 +556,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 +570,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 +611,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 +625,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"))
|
|
|
{
|
|
|
@@ -576,7 +698,6 @@ namespace UAS_LabelMachine
|
|
|
//重新输入单号后清除缓存
|
|
|
MidBoxArgument.Clear();
|
|
|
SingleBoxArgument.Clear();
|
|
|
- MidIDAndOutboxcode.Clear();
|
|
|
SingleID.Clear();
|
|
|
Input.Focus();
|
|
|
//从后往前找未采集的行
|
|
|
@@ -604,10 +725,22 @@ 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();
|
|
|
SingleID.Clear();
|
|
|
//获取全部的中盒号
|
|
|
Dictionary<string, bool> outboxcode1 = new Dictionary<string, bool>();
|
|
|
@@ -617,14 +750,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (!SingleID.Contains(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString()))
|
|
|
SingleID.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString());
|
|
|
- if (LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString().ToLower() == "true" && LabelInf.Rows[i].Cells["pib_ifprint"].FormattedValue.ToString() != "true")
|
|
|
- {
|
|
|
- //如果不存在中盒号则进行添加
|
|
|
- if (!MidIDAndOutboxcode.ContainsValue(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()))
|
|
|
- {
|
|
|
- MidIDAndOutboxcode.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString(), LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString());
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
if (SingleID.ToArray().Length == 0)
|
|
|
{
|
|
|
@@ -656,13 +781,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;
|
|
|
@@ -775,8 +905,6 @@ namespace UAS_LabelMachine
|
|
|
string la_id = MidLabelCombox.SelectedValue.ToString().Split('#')[0];
|
|
|
for (int i = (begin == 0 ? 0 : begin); i <= (end == 0 ? LabelInf.Rows.Count - 1 : end); i++)
|
|
|
{
|
|
|
- if (!MidIDAndOutboxcode.ContainsValue(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()))
|
|
|
- MidIDAndOutboxcode.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString(), LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString());
|
|
|
if (!MidOutBoxCode.Contains(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())))
|
|
|
{
|
|
|
MidOutBoxCode.Add(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()));
|
|
|
@@ -912,15 +1040,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.ShowDialog = false;
|
|
|
- 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();
|
|
|
}
|
|
|
@@ -930,14 +1064,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.ShowDialog = false;
|
|
|
- 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();
|
|
|
}
|
|
|
@@ -955,15 +1097,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.ShowDialog = false;
|
|
|
- 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, "提示"); }
|
|
|
@@ -1110,7 +1257,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) { }
|
|
|
@@ -1127,7 +1280,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) { }
|
|
|
@@ -1144,7 +1303,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) { }
|