|
@@ -13,6 +13,7 @@ using UAS_LabelMachine.PublicForm;
|
|
|
using System.Threading;
|
|
using System.Threading;
|
|
|
using System.IO;
|
|
using System.IO;
|
|
|
using System.Globalization;
|
|
using System.Globalization;
|
|
|
|
|
+using FastReport;
|
|
|
|
|
|
|
|
namespace UAS_LabelMachine
|
|
namespace UAS_LabelMachine
|
|
|
{
|
|
{
|
|
@@ -33,15 +34,15 @@ namespace UAS_LabelMachine
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// 单盘打印文件
|
|
/// 单盘打印文件
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- Document SingleDoc;
|
|
|
|
|
|
|
+ Report SingleReport = new Report();
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// 中盒打印文件
|
|
/// 中盒打印文件
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- Document MidDoc;
|
|
|
|
|
|
|
+ Report MidReport = new Report();
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// 外箱打印文件
|
|
/// 外箱打印文件
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- Document OutBoxDoc;
|
|
|
|
|
|
|
+ Report OutReport = new Report();
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// 唛头文件
|
|
/// 唛头文件
|
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -61,10 +62,6 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
|
|
bool logout = false;
|
|
bool logout = false;
|
|
|
|
|
|
|
|
- DataTable SingleLabelParam;
|
|
|
|
|
- DataTable MidLabelParam;
|
|
|
|
|
- DataTable OutLabelParam;
|
|
|
|
|
-
|
|
|
|
|
//主表数据源
|
|
//主表数据源
|
|
|
DataTable LabelInfDataTable;
|
|
DataTable LabelInfDataTable;
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -117,12 +114,6 @@ namespace UAS_LabelMachine
|
|
|
int NumLength = 0;
|
|
int NumLength = 0;
|
|
|
int Radix = 0;
|
|
int Radix = 0;
|
|
|
|
|
|
|
|
- string SingleSQL = "";
|
|
|
|
|
-
|
|
|
|
|
- string MidSQL = "";
|
|
|
|
|
-
|
|
|
|
|
- string OutSQL = "";
|
|
|
|
|
-
|
|
|
|
|
private bool EnablePrint = true;
|
|
private bool EnablePrint = true;
|
|
|
|
|
|
|
|
string[] PIBID;
|
|
string[] PIBID;
|
|
@@ -204,12 +195,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
{
|
|
|
客户标签维护 form = new 客户标签维护();
|
|
客户标签维护 form = new 客户标签维护();
|
|
|
BaseUtil.SetFormCenter(form);
|
|
BaseUtil.SetFormCenter(form);
|
|
|
- if (SingleDoc != null)
|
|
|
|
|
- SingleDoc.Close();
|
|
|
|
|
- if (MidDoc != null)
|
|
|
|
|
- MidDoc.Close();
|
|
|
|
|
- if (OutBoxDoc != null)
|
|
|
|
|
- OutBoxDoc.Close();
|
|
|
|
|
if (FootDoc != null)
|
|
if (FootDoc != null)
|
|
|
FootDoc.Close();
|
|
FootDoc.Close();
|
|
|
form.FormClosed += LabelFormClose;
|
|
form.FormClosed += LabelFormClose;
|
|
@@ -381,7 +366,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("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("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("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 ? 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 && SingleLabelAutoPrint.Checked ? 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 + "'");
|
|
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());
|
|
dh.BatchInsert(sql.ToString(), new string[] { "PIB_ID", "PIB_CUSTBARCODE" }, PIBID, CustBarCode.ToArray());
|
|
|
//更新流水号
|
|
//更新流水号
|
|
@@ -437,37 +422,17 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
{
|
|
|
if (EnablePrint)
|
|
if (EnablePrint)
|
|
|
{
|
|
{
|
|
|
- try
|
|
|
|
|
- {
|
|
|
|
|
- if (SingleDoc.Variables.FreeVariables.Count == 0)
|
|
|
|
|
- {
|
|
|
|
|
- MessageBox.Show("单盘标签未维护参数", "提示");
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- catch (Exception)
|
|
|
|
|
- {
|
|
|
|
|
- MessageBox.Show("单盘标签未维护参数", "提示");
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
//用标签本身的变量作为最外层的循环条件去匹配;
|
|
//用标签本身的变量作为最外层的循环条件去匹配;
|
|
|
string[] arg = SingleBoxArgument.ToArray();
|
|
string[] arg = SingleBoxArgument.ToArray();
|
|
|
StringBuilder ParamLog = new StringBuilder();
|
|
StringBuilder ParamLog = new StringBuilder();
|
|
|
for (int i = 0; i < PIBID.Length; i++)
|
|
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.SPrinter = SingleLabelPrinter.Text;
|
|
|
Properties.Settings.Default.Save();
|
|
Properties.Settings.Default.Save();
|
|
|
}
|
|
}
|
|
@@ -506,8 +471,6 @@ namespace UAS_LabelMachine
|
|
|
SingleLabelCombox.DisplayMember = "cl_labelname";
|
|
SingleLabelCombox.DisplayMember = "cl_labelname";
|
|
|
SingleLabelCombox.ValueMember = "la_id";
|
|
SingleLabelCombox.ValueMember = "la_id";
|
|
|
SingleLabelCombox.DataSource = dt;
|
|
SingleLabelCombox.DataSource = dt;
|
|
|
- if (SingleDoc != null)
|
|
|
|
|
- SingleDoc.Close();
|
|
|
|
|
if (!GetGridOnly.Checked)
|
|
if (!GetGridOnly.Checked)
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
{
|
|
@@ -520,37 +483,9 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
}
|
|
|
if (SingleLabelCombox.Text != "")
|
|
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.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 ");
|
|
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.DisplayMember = "cl_labelname";
|
|
|
MidLabelCombox.ValueMember = "la_id";
|
|
MidLabelCombox.ValueMember = "la_id";
|
|
|
MidLabelCombox.DataSource = dt;
|
|
MidLabelCombox.DataSource = dt;
|
|
|
- if (MidDoc != null)
|
|
|
|
|
- MidDoc.Close();
|
|
|
|
|
if (!GetGridOnly.Checked)
|
|
if (!GetGridOnly.Checked)
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
{
|
|
@@ -574,37 +507,8 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
}
|
|
|
if (MidLabelCombox.Text != "")
|
|
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();
|
|
sql.Clear();
|
|
@@ -615,8 +519,6 @@ namespace UAS_LabelMachine
|
|
|
OutBoxCombox.DisplayMember = "cl_labelname";
|
|
OutBoxCombox.DisplayMember = "cl_labelname";
|
|
|
OutBoxCombox.ValueMember = "la_id";
|
|
OutBoxCombox.ValueMember = "la_id";
|
|
|
OutBoxCombox.DataSource = dt;
|
|
OutBoxCombox.DataSource = dt;
|
|
|
- if (OutBoxDoc != null)
|
|
|
|
|
- OutBoxDoc.Close();
|
|
|
|
|
if (!GetGridOnly.Checked)
|
|
if (!GetGridOnly.Checked)
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
{
|
|
@@ -629,37 +531,9 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
}
|
|
|
if (OutBoxCombox.Text != "")
|
|
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"))
|
|
if (!File.Exists(ftpOperater.DownLoadTo + "唛头.lab"))
|
|
|
{
|
|
{
|
|
@@ -730,20 +604,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
{
|
|
|
if (EnablePrint)
|
|
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,后面会判断需要打印的数据重新加载
|
|
//每次打印清除之前缓存的行号和ID,后面会判断需要打印的数据重新加载
|
|
|
MidIDAndOutboxcode.Clear();
|
|
MidIDAndOutboxcode.Clear();
|
|
@@ -795,18 +656,13 @@ namespace UAS_LabelMachine
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
string pib_id = LabelInf.Rows[i].Cells["pib_id1"].Value.ToString();
|
|
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.SPrinter = SingleLabelPrinter.Text;
|
|
|
Properties.Settings.Default.Save();
|
|
Properties.Settings.Default.Save();
|
|
|
LabelInf.Rows[i].Cells["pib_ifprint"].Value = true;
|
|
LabelInf.Rows[i].Cells["pib_ifprint"].Value = true;
|
|
@@ -1056,21 +912,14 @@ namespace UAS_LabelMachine
|
|
|
if (EnablePrint)
|
|
if (EnablePrint)
|
|
|
{
|
|
{
|
|
|
string[] arg = MidBoxArgument.ToArray();
|
|
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.MPrinter = MidLabelPrinter.Text;
|
|
|
Properties.Settings.Default.Save();
|
|
Properties.Settings.Default.Save();
|
|
|
}
|
|
}
|
|
@@ -1080,22 +929,13 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
{
|
|
|
if (EnablePrint)
|
|
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.MPrinter = MidLabelPrinter.Text;
|
|
|
Properties.Settings.Default.Save();
|
|
Properties.Settings.Default.Save();
|
|
|
}
|
|
}
|
|
@@ -1113,20 +953,14 @@ namespace UAS_LabelMachine
|
|
|
//将维护的模板参数和模板本身的参数名称进行比对
|
|
//将维护的模板参数和模板本身的参数名称进行比对
|
|
|
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();
|
|
|
- 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.OPrinter = OutBoxPrinter.Text;
|
|
|
Properties.Settings.Default.Save();
|
|
Properties.Settings.Default.Save();
|
|
|
- LogManager.DoLog("执行打印外箱,pib_id:" + LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString());
|
|
|
|
|
LogManager.DoCommandLog(pi_inoutno.Text, User.UserCode, "手动打印外箱箱标", "打印成功");
|
|
LogManager.DoCommandLog(pi_inoutno.Text, User.UserCode, "手动打印外箱箱标", "打印成功");
|
|
|
}
|
|
}
|
|
|
catch (Exception ex) { MessageBox.Show(ex.Message, "提示"); }
|
|
catch (Exception ex) { MessageBox.Show(ex.Message, "提示"); }
|
|
@@ -1273,13 +1107,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
{
|
|
|
if (ComBoxClickChangeLabelDoc)
|
|
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) { }
|
|
catch (Exception) { }
|
|
@@ -1296,13 +1124,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
{
|
|
|
if (ComBoxClickChangeLabelDoc)
|
|
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) { }
|
|
catch (Exception) { }
|
|
@@ -1319,13 +1141,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
{
|
|
|
if (ComBoxClickChangeLabelDoc)
|
|
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) { }
|
|
catch (Exception) { }
|
|
@@ -1711,12 +1527,12 @@ namespace UAS_LabelMachine
|
|
|
//如果不是10的整数倍则为尾盒
|
|
//如果不是10的整数倍则为尾盒
|
|
|
for (int j = 0; j < dt1.Rows.Count; j++)
|
|
for (int j = 0; j < dt1.Rows.Count; j++)
|
|
|
{
|
|
{
|
|
|
- if (j % 10 == 0)
|
|
|
|
|
|
|
+ if (j % 10 == 0 && j != 0)
|
|
|
{
|
|
{
|
|
|
pib_outboxcode1 = pib_outboxcode1 + 1;
|
|
pib_outboxcode1 = pib_outboxcode1 + 1;
|
|
|
- MaxNum = MaxNum + 1;
|
|
|
|
|
|
|
+ CurrentMaxNum = CurrentMaxNum + 1;
|
|
|
}
|
|
}
|
|
|
- string serialcode = BaseUtil.DToAny(MaxNum, Radix);
|
|
|
|
|
|
|
+ string serialcode = BaseUtil.DToAny(CurrentMaxNum, Radix);
|
|
|
for (int k = serialcode.ToString().Length; k < NumLength; k++)
|
|
for (int k = serialcode.ToString().Length; k < NumLength; k++)
|
|
|
{
|
|
{
|
|
|
serialcode = "0" + serialcode;
|
|
serialcode = "0" + serialcode;
|
|
@@ -1727,7 +1543,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
}
|
|
|
dh.BatchInsert("update prodiobarcode set pib_custmidboxcode=:pib_custmidboxcode,pib_outboxcode1=:pib_outboxcode1 where pib_id=:pib_id and pib_custmidboxcode is null", new string[] { "pib_custmidboxcode", "pib_outboxcode1", "pib_id" }, MidBoxCode.ToArray(), PIBOUTBOXCODE1.ToArray(), PIBID.ToArray());
|
|
dh.BatchInsert("update prodiobarcode set pib_custmidboxcode=:pib_custmidboxcode,pib_outboxcode1=:pib_outboxcode1 where pib_id=:pib_id and pib_custmidboxcode is null", new string[] { "pib_custmidboxcode", "pib_outboxcode1", "pib_id" }, MidBoxCode.ToArray(), PIBOUTBOXCODE1.ToArray(), PIBID.ToArray());
|
|
|
}
|
|
}
|
|
|
- MaxNum = MaxNum + 1;
|
|
|
|
|
|
|
+ CurrentMaxNum = CurrentMaxNum + 1;
|
|
|
//生成外箱条码
|
|
//生成外箱条码
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
{
|
|
@@ -1743,7 +1559,7 @@ namespace UAS_LabelMachine
|
|
|
MaxNum = MaxNum + 1;
|
|
MaxNum = MaxNum + 1;
|
|
|
dh.BatchInsert("update prodiobarcode set pib_custoutboxcode=:pib_custoutboxcode where pib_outboxcode2=:pib_outboxcode2 and pib_custoutboxcode is null", new string[] { "pib_custoutboxcode", "pib_outboxcode2" }, OutBoxCode.ToArray(), PIBOUTBOXCODE2.ToArray());
|
|
dh.BatchInsert("update prodiobarcode set pib_custoutboxcode=:pib_custoutboxcode where pib_outboxcode2=:pib_outboxcode2 and pib_custoutboxcode is null", new string[] { "pib_custoutboxcode", "pib_outboxcode2" }, OutBoxCode.ToArray(), PIBOUTBOXCODE2.ToArray());
|
|
|
}
|
|
}
|
|
|
- dh.UpdateByCondition("RULEMAXNUM", "rmn_maxnumber='" + MaxNum + "'", "rmn_nrcode='" + pi_cardcode.Text + "' and rmn_prefix='" + Prefix + "'");
|
|
|
|
|
|
|
+ dh.UpdateByCondition("RULEMAXNUM", "rmn_maxnumber='" + CurrentMaxNum + "'", "rmn_nrcode='" + pi_cardcode.Text + "' and rmn_prefix='" + Prefix + "'");
|
|
|
}
|
|
}
|
|
|
LoadGridData(sender, e);
|
|
LoadGridData(sender, e);
|
|
|
}
|
|
}
|