|
@@ -145,6 +145,8 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
List<string> OutParam = new List<string>();
|
|
|
|
|
|
+ DataTable Attach;
|
|
|
+
|
|
|
public UAS_出货标签打印(string Master)
|
|
|
{
|
|
|
InitializeComponent();
|
|
@@ -378,6 +380,12 @@ namespace UAS_LabelMachine
|
|
|
return;
|
|
|
}
|
|
|
CollectInputData();
|
|
|
+ DataTable savedt = (LabelInf.DataSource as DataTable);
|
|
|
+ if (savedt != null && savedt.GetChanges() != null)
|
|
|
+ {
|
|
|
+ MidSource.EndEdit();
|
|
|
+ dh.SaveDataTable(savedt.GetChanges(), "ProdioBarCode", "pib_id");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -687,49 +695,16 @@ namespace UAS_LabelMachine
|
|
|
DataRow[] dr = SingleBoxCacheData.Select("pib_id=" + pib_id);
|
|
|
if (arg.Contains(SingleDoc.Variables.FreeVariables.Item(j + 1).Name))
|
|
|
SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr[0][SingleDoc.Variables.FreeVariables.Item(j + 1).Name].ToString();
|
|
|
- if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.Contains("datecode1"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value.ToString();
|
|
|
- }
|
|
|
- else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.Contains("lotno"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString();
|
|
|
- }
|
|
|
- else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.Contains("datecode"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString();
|
|
|
- }
|
|
|
- else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.Contains("产地"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[CurrentRowIndex].Cells["pib_madein"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_madein"].Value.ToString();
|
|
|
- }
|
|
|
- else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.Contains("pib_cusbarcode"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[CurrentRowIndex].Cells["pib_cusbarcode"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_cusbarcode"].Value.ToString();
|
|
|
- }
|
|
|
if (SingleDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
|
{
|
|
|
- try
|
|
|
- {
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'")[0]["lp_sql"].ToString();
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
+ DataRow[] dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
|
|
|
+ if (dr1.Length > 0)
|
|
|
{
|
|
|
-
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
}
|
|
|
}
|
|
|
ParamLog.AppendLine("pib_id:" + LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString() + ",SingleDoc打印参数【" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取到值" + SingleDoc.Variables.FreeVariables.Item(j + 1).Value);
|
|
|
}
|
|
|
- else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name == "DateCode1")
|
|
|
- {
|
|
|
- if (LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value.ToString();
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
LogManager.DoLog(ParamLog.ToString());
|
|
@@ -1067,7 +1042,7 @@ namespace UAS_LabelMachine
|
|
|
private void GetInOutInfAndLabelFile()
|
|
|
{
|
|
|
ComBoxClickChangeLabelDoc = false;
|
|
|
- DataTable Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LabelAttachPARAMETER where lap_custcode='" + pi_cardcode.Text + "'", "select");
|
|
|
+ Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LabelAttachPARAMETER where lap_custcode='" + pi_cardcode.Text + "'", "select");
|
|
|
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("left join customer on cu_code=cl_custcode left join label on la_code=CL_LABELCODE where ((pi_cardcode='" + pi_cardcode.Text + "' ");
|
|
@@ -1092,7 +1067,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
SingleDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + SingleLabelCombox.Text);
|
|
|
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], "select");
|
|
|
- SingleLabelParam.Merge(Attach);
|
|
|
for (int i = 0; i < SingleDoc.Variables.FreeVariables.Count; i++)
|
|
|
{
|
|
|
SingleParam.Add(SingleDoc.Variables.FreeVariables.Item(i + 1).Name);
|
|
@@ -1122,7 +1096,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
MidDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + MidLabelCombox.Text);
|
|
|
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], "select");
|
|
|
- MidLabelParam.Merge(Attach);
|
|
|
}
|
|
|
//缓存中盒参数
|
|
|
sql.Clear();
|
|
@@ -1149,11 +1122,11 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
OutBoxDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + OutBoxCombox.Text);
|
|
|
OutLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql,lp_valuetype from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + OutBoxCombox.SelectedValue.ToString().Split('#')[0], "select");
|
|
|
- OutLabelParam.Merge(Attach);
|
|
|
}
|
|
|
//缓存外箱参数
|
|
|
ComBoxClickChangeLabelDoc = true;
|
|
|
- Parallel.Invoke(GetSingleBoxData, GetMidBoxData);
|
|
|
+ GetSingleBoxData();
|
|
|
+ GetMidBoxData();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1311,46 +1284,17 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (arg.Contains(SingleDoc.Variables.FreeVariables.Item(j + 1).Name))
|
|
|
SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr[0][SingleDoc.Variables.FreeVariables.Item(j + 1).Name].ToString();
|
|
|
- if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode1"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[i].Cells["pib_datecode1"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_datecode1"].Value.ToString();
|
|
|
- }
|
|
|
- else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("lotno"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[i].Cells["pib_lotno"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_lotno"].Value.ToString();
|
|
|
- }
|
|
|
- else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[i].Cells["pib_datecode"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_datecode"].Value.ToString();
|
|
|
- }
|
|
|
- else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("产地"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[i].Cells["pib_madein"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_madein"].Value.ToString();
|
|
|
- }
|
|
|
- else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("pib_cusbarcode"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[i].Cells["pib_cusbarcode"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_cusbarcode"].Value.ToString();
|
|
|
- }
|
|
|
if (SingleDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
|
{
|
|
|
- try
|
|
|
- {
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'")[0]["lp_sql"].ToString();
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
+ DataRow[] dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
|
|
|
+ if (dr1.Length > 0)
|
|
|
{
|
|
|
-
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
}
|
|
|
}
|
|
|
ParamLog.AppendLine("pib_id:" + LabelInf.Rows[i].Cells["pib_id1"].Value.ToString() + ",SingleDoc打印参数【" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取到值" + SingleDoc.Variables.FreeVariables.Item(j + 1).Value);
|
|
|
}
|
|
|
LogManager.DoLog(ParamLog.ToString());
|
|
|
-
|
|
|
SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
SingleDoc.PrintDocument();
|
|
|
if (MidLabelAutoPrint.Checked)
|
|
@@ -1775,9 +1719,6 @@ namespace UAS_LabelMachine
|
|
|
GetMidBoxData();
|
|
|
}
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + la_id, "select");
|
|
|
- DataTable Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LabelAttachPARAMETER where lap_custcode='" + pi_cardcode.Text + "'", "select");
|
|
|
- //用标签本身的变量作为最外层的循环条件去匹配;
|
|
|
- dt.Merge(Attach);
|
|
|
string[] arg = MidBoxArgument.ToArray();
|
|
|
for (int j = 0; j < MidDoc.Variables.FreeVariables.Count; j++)
|
|
|
{
|
|
@@ -1803,22 +1744,7 @@ namespace UAS_LabelMachine
|
|
|
else
|
|
|
{
|
|
|
DataRow[] dr = MidBoxCacheData.Select("pib_outboxcode1='" + pib_outboxcode1 + "'");
|
|
|
- if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode1"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[rowindex].Cells["pib_datecode1"].Value != null)
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode1"].Value.ToString();
|
|
|
- }
|
|
|
- else if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("lotno"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[rowindex].Cells["pib_lotno"].Value != null)
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_lotno"].Value.ToString();
|
|
|
- }
|
|
|
- else if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[rowindex].Cells["pib_datecode"].Value != null)
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode"].Value.ToString();
|
|
|
- }
|
|
|
- else if (arg.Contains(MidDoc.Variables.FreeVariables.Item(j + 1).Name))
|
|
|
+ if (arg.Contains(MidDoc.Variables.FreeVariables.Item(j + 1).Name))
|
|
|
{
|
|
|
if (dr.Length > 0)
|
|
|
{
|
|
@@ -1827,13 +1753,10 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
if (MidDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
|
{
|
|
|
- try
|
|
|
+ DataRow[] dr1 = Attach.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
|
|
|
+ if (dr1.Length > 0)
|
|
|
{
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "'")[0]["lp_sql"].ToString();
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
-
|
|
|
+ MidDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
}
|
|
|
}
|
|
|
LogManager.DoLog("打印参数【" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + sql + ",取到值" + MidDoc.Variables.FreeVariables.Item(j + 1).Value);
|
|
@@ -1876,45 +1799,24 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode1"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[rowindex].Cells["pib_datecode1"].Value != null)
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode1"].Value.ToString();
|
|
|
- }
|
|
|
- else if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("lotno"))
|
|
|
+ if (sql.ToLower().Contains("pib_qty"))
|
|
|
{
|
|
|
- if (LabelInf.Rows[rowindex].Cells["pib_lotno"].Value != null)
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_lotno"].Value.ToString();
|
|
|
- }
|
|
|
- else if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[rowindex].Cells["pib_datecode"].Value != null)
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode"].Value.ToString();
|
|
|
+ sql = sql.Substring(0, sql.IndexOf("{")) + pib_id + sql.Substring(sql.IndexOf("}") + 1);
|
|
|
+ sql = sql.Substring(0, sql.LastIndexOf("=")) + "='" + pib_outboxcode1 + "' group by pib_outboxcode1";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (sql.ToLower().Contains("pib_qty"))
|
|
|
- {
|
|
|
- sql = sql.Substring(0, sql.IndexOf("{")) + pib_id + sql.Substring(sql.IndexOf("}") + 1);
|
|
|
- sql = sql.Substring(0, sql.LastIndexOf("=")) + "='" + pib_outboxcode1 + "' group by pib_outboxcode1";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- sql = sql.Substring(0, sql.IndexOf("{"));
|
|
|
- sql = sql.Substring(0, sql.LastIndexOf("="));
|
|
|
- sql = sql + " in (select distinct pib_outboxcode1 from PRODIOBARCODE where pib_inoutno='" + pi_inoutno.Text + "')" + " and pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1='" + pib_outboxcode1 + "'";
|
|
|
- }
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = dh.GetLabelParam(sql).ToString();
|
|
|
+ sql = sql.Substring(0, sql.IndexOf("{"));
|
|
|
+ sql = sql.Substring(0, sql.LastIndexOf("="));
|
|
|
+ sql = sql + " in (select distinct pib_outboxcode1 from PRODIOBARCODE where pib_inoutno='" + pi_inoutno.Text + "')" + " and pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1='" + pib_outboxcode1 + "'";
|
|
|
}
|
|
|
+ MidDoc.Variables.FreeVariables.Item(j + 1).Value = dh.GetLabelParam(sql).ToString();
|
|
|
if (MidDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
|
{
|
|
|
- try
|
|
|
- {
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "'")[0]["lp_sql"].ToString();
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
+ DataRow[] dr1 = Attach.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
|
|
|
+ if (dr1.Length > 0)
|
|
|
{
|
|
|
-
|
|
|
+ MidDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
}
|
|
|
}
|
|
|
LogManager.DoLog("打印参数【" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + sql + ",取到值" + MidDoc.Variables.FreeVariables.Item(j + 1).Value);
|
|
@@ -1938,9 +1840,6 @@ namespace UAS_LabelMachine
|
|
|
private void OutBoxCodePrint(string la_id, int rowindex)
|
|
|
{
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql("select lp_name,lp_sql,lp_valuetype from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + la_id, "select");
|
|
|
- DataTable Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LabelAttachPARAMETER where lap_custcode='" + pi_cardcode.Text + "'", "select");
|
|
|
- //用标签本身的变量作为最外层的循环条件去匹配;
|
|
|
- dt.Merge(Attach);
|
|
|
try
|
|
|
{
|
|
|
for (int j = 0; j < OutBoxDoc.Variables.FreeVariables.Count; j++)
|
|
@@ -1951,70 +1850,33 @@ namespace UAS_LabelMachine
|
|
|
//名称相等的时候,取SQL进行值的查询
|
|
|
if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name == OutLabelParam.Rows[k]["lp_name"].ToString())
|
|
|
{
|
|
|
- //如果毛重填写的是毛重或者净重
|
|
|
- if (OutLabelParam.Rows[k]["lp_valuetype"].ToString() == "字符串" && OutLabelParam.Rows[k]["lp_sql"].ToString() == "GW")
|
|
|
- {
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = WeightGross.Text;
|
|
|
- LogManager.DoLog("打印参数【毛重】赋值," + WeightGross.Text);
|
|
|
- }
|
|
|
- else if (OutLabelParam.Rows[k]["lp_valuetype"].ToString() == "字符串" && OutLabelParam.Rows[k]["lp_sql"].ToString() == "NW")
|
|
|
- {
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = WeightNet.Text;
|
|
|
- LogManager.DoLog("打印参数【净重】赋值," + WeightNet.Text);
|
|
|
- }
|
|
|
- else
|
|
|
+ //获取对应行的pib_id
|
|
|
+ string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
+ string pib_outboxcode2 = LabelInf.Rows[rowindex].Cells["pib_outboxcode2"].Value.ToString();
|
|
|
+ //获取打印执行的SQL
|
|
|
+ string sql = OutLabelParam.Rows[k]["lp_sql"].ToString();
|
|
|
+ //select * from productiobarcode where pib_id={pib_id} and pib_outboxcode1={pib_outboxcode1}
|
|
|
+ try
|
|
|
{
|
|
|
- //获取对应行的pib_id
|
|
|
- string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
- string pib_outboxcode2 = LabelInf.Rows[rowindex].Cells["pib_outboxcode2"].Value.ToString();
|
|
|
- //获取打印执行的SQL
|
|
|
- string sql = OutLabelParam.Rows[k]["lp_sql"].ToString();
|
|
|
- //select * from productiobarcode where pib_id={pib_id} and pib_outboxcode1={pib_outboxcode1}
|
|
|
- try
|
|
|
+ string ExeSQL = "";
|
|
|
+ ExeSQL = sql.ToLower().Replace("{pib_id}", "'" + pib_id + "'");
|
|
|
+ ExeSQL = ExeSQL.Replace("{pib_outboxcode2}", "'" + pib_outboxcode2 + "'");
|
|
|
+ OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dh.GetLabelParam(ExeSQL).ToString();
|
|
|
+ if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
|
{
|
|
|
- string ExeSQL = "";
|
|
|
- if (sql.ToLower().Contains("pib_lotno"))
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_lotno"].Value.ToString();
|
|
|
- else if (sql.ToLower().Contains("pib_datecode"))
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode"].Value.ToString();
|
|
|
- else if (sql.ToLower().Contains("pib_madein"))
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_madein"].Value.ToString();
|
|
|
- else if (sql.ToLower().Contains("pib_cusbarcode"))
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_cusbarcode"].Value.ToString();
|
|
|
- else if (sql.ToLower().Contains("pib_cusoutboxcode"))
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_cusoutboxcode"].Value.ToString();
|
|
|
- else
|
|
|
+ DataRow[] dr1 = Attach.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
|
|
|
+ if (dr1.Length > 0)
|
|
|
{
|
|
|
- ExeSQL = sql.ToLower().Replace("{pib_id}", "'" + pib_id + "'");
|
|
|
- ExeSQL = ExeSQL.Replace("{pib_outboxcode2}", "'" + pib_outboxcode2 + "'");
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dh.GetLabelParam(ExeSQL).ToString();
|
|
|
- }
|
|
|
- if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name + "'")[0]["lp_sql"].ToString();
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
+ OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
}
|
|
|
- LogManager.DoLog("打印参数【" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + ExeSQL + ",取到值" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value);
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
- LogManager.DoLog("SQL维护不正确,请检查SQL语句" + sql);
|
|
|
- MessageBox.Show("SQL维护不正确,请检查SQL语句\n" + sql);
|
|
|
- return;
|
|
|
}
|
|
|
+ LogManager.DoLog("打印参数【" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + ExeSQL + ",取到值" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value);
|
|
|
}
|
|
|
- }
|
|
|
- else if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name == "DateCode1")
|
|
|
- {
|
|
|
- if (LabelInf.Rows[rowindex].Cells["pib_datecode1"].Value != null)
|
|
|
+ catch (Exception)
|
|
|
{
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode1"].Value.ToString();
|
|
|
+ LogManager.DoLog("SQL维护不正确,请检查SQL语句" + sql);
|
|
|
+ MessageBox.Show("SQL维护不正确,请检查SQL语句\n" + sql);
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2421,9 +2283,12 @@ namespace UAS_LabelMachine
|
|
|
for (int i = 0; i < LabelInf.Rows.Count; i++)
|
|
|
{
|
|
|
LabelInf.Rows[i].Cells["pib_outboxcode2"].Value = BoxCode;
|
|
|
- if (int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()) % OutboxCapacity.Value == 0)
|
|
|
+ if (i + 1 < LabelInf.Rows.Count + 1)
|
|
|
{
|
|
|
- BoxCode = BoxCode + 1;
|
|
|
+ if (int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()) % OutboxCapacity.Value == 0 && (LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString() != LabelInf.Rows[i + 1].Cells["pib_outboxcode1"].Value.ToString()))
|
|
|
+ {
|
|
|
+ BoxCode = BoxCode + 1;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2707,7 +2572,7 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
private void RefreshDBConnect_Tick(object sender, EventArgs e)
|
|
|
{
|
|
|
- dh.ExecuteSql("select count(1) from employee", "select");
|
|
|
+ dh.ExecuteSql("select sysdate from dual", "select");
|
|
|
}
|
|
|
}
|
|
|
}
|