|
|
@@ -222,6 +222,7 @@ namespace UAS_LabelMachine
|
|
|
if (DataHelper.DBConnectionString.Contains("sz.hi-mantech.com") || DataHelper.DBConnectionString.Contains("192.168.1.200"))
|
|
|
{
|
|
|
pib_datecode1.Visible = true;
|
|
|
+ pib_datecode.HeaderText = "DC年月日";
|
|
|
SingleLabelAutoPrint.Checked = true;
|
|
|
MidLabelAutoPrint.Checked = true;
|
|
|
pib_madein.Visible = true;
|
|
|
@@ -542,19 +543,13 @@ namespace UAS_LabelMachine
|
|
|
DataTable dt = (DataTable)MidSource.DataSource;
|
|
|
if (CollectionUnit.Text == "盒")
|
|
|
{
|
|
|
- string la_id = "";
|
|
|
- if (SingleLabelCombox.SelectedValue != null)
|
|
|
- {
|
|
|
- la_id = SingleLabelCombox.SelectedValue.ToString().Split('#')[0];
|
|
|
- }
|
|
|
- string cl_labelname = SingleLabelCombox.Text;
|
|
|
- string LabelUrl = dh.getFieldDataByCondition("label left join customerlabel on la_code=cl_labelcode", "cl_labelurl", "la_id='" + la_id + "' and cl_labelname='" + cl_labelname + "'").ToString();
|
|
|
for (int i = 0; i < LabelInf.RowCount; i++)
|
|
|
{
|
|
|
if (LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString() == LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value.ToString())
|
|
|
{
|
|
|
dt.Rows[i]["pib_lotno"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value;
|
|
|
dt.Rows[i]["pib_datecode"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value;
|
|
|
+ dt.Rows[i]["pib_datecode1"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value;
|
|
|
LabelInf.Rows[i].Cells["pib_ifpick"].Value = true;
|
|
|
LabelInf.Rows[i].Cells["Choose"].Value = true;
|
|
|
LabelInf.Invalidate();
|
|
|
@@ -562,13 +557,7 @@ namespace UAS_LabelMachine
|
|
|
CurrentRowIndex = i;
|
|
|
if (SingleLabelAutoPrint.Checked)
|
|
|
{
|
|
|
- if (la_id != "")
|
|
|
- AutoPrintSingleLabel(la_id, LabelUrl);
|
|
|
- else
|
|
|
- {
|
|
|
- MessageBox.Show("未维护单盘标签");
|
|
|
- return;
|
|
|
- }
|
|
|
+ AutoPrintSingleLabel();
|
|
|
}
|
|
|
if (MidLabelAutoPrint.Checked)
|
|
|
AutoPrintMidLabel();
|
|
|
@@ -582,6 +571,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
dt.Rows[i]["pib_lotno"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value;
|
|
|
dt.Rows[i]["pib_datecode"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value;
|
|
|
+ dt.Rows[i]["pib_datecode1"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value;
|
|
|
CurrentRowIndex = i;
|
|
|
LabelInf.Refresh();
|
|
|
LabelInf.Rows[i].Cells["pib_ifpick"].Value = true;
|
|
|
@@ -600,10 +590,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (SingleLabelCombox.SelectedValue != null)
|
|
|
{
|
|
|
- string la_id = SingleLabelCombox.SelectedValue.ToString().Split('#')[0];
|
|
|
- string cl_labelname = SingleLabelCombox.Text;
|
|
|
- string LabelUrl = dh.getFieldDataByCondition("label left join customerlabel on la_code=cl_labelcode", "cl_labelurl", "la_id='" + la_id + "' and cl_labelname='" + cl_labelname + "'").ToString();
|
|
|
- AutoPrintSingleLabel(la_id, LabelUrl);
|
|
|
+ AutoPrintSingleLabel();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -676,7 +663,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void AutoPrintSingleLabel(string la_id, string LabelUrl)
|
|
|
+ private void AutoPrintSingleLabel()
|
|
|
{
|
|
|
//用标签本身的变量作为最外层的循环条件去匹配;
|
|
|
string[] arg = SingleBoxArgument.ToArray();
|
|
|
@@ -687,12 +674,37 @@ namespace UAS_LabelMachine
|
|
|
for (int k = 0; k < SingleLabelParam.Rows.Count; k++)
|
|
|
{
|
|
|
//名称相等的时候,取SQL进行值的查询
|
|
|
- if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name == SingleLabelParam.Rows[k]["lp_name"].ToString().ToLower())
|
|
|
+ if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() == SingleLabelParam.Rows[k]["lp_name"].ToString().ToLower())
|
|
|
{
|
|
|
string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
|
|
|
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.ToLower().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.ToLower().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.ToLower().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.ToLower().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.ToLower().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 == "")
|
|
|
{
|
|
|
DataRow[] dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
|
|
|
@@ -1276,6 +1288,31 @@ 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 == "")
|
|
|
{
|
|
|
DataRow[] dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
|
|
|
@@ -1358,7 +1395,7 @@ namespace UAS_LabelMachine
|
|
|
//将维护的模板参数和模板本身的参数名称进行比对
|
|
|
for (int k = 0; k < SingleLabelParam.Rows.Count; k++)
|
|
|
{
|
|
|
- if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name == SingleLabelParam.Rows[k]["lp_name"].ToString())
|
|
|
+ if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() == SingleLabelParam.Rows[k]["lp_name"].ToString().ToLower())
|
|
|
{
|
|
|
DataColumn dc = new DataColumn(SingleDoc.Variables.FreeVariables.Item(j + 1).Name);
|
|
|
SingleBoxCacheData.Columns.Add(dc);
|
|
|
@@ -1444,7 +1481,7 @@ namespace UAS_LabelMachine
|
|
|
//将维护的模板参数和模板本身的参数名称进行比对
|
|
|
for (int k = 0; k < MidLabelParam.Rows.Count; k++)
|
|
|
{
|
|
|
- if (MidDoc.Variables.FreeVariables.Item(j + 1).Name == MidLabelParam.Rows[k]["lp_name"].ToString())
|
|
|
+ if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() == MidLabelParam.Rows[k]["lp_name"].ToString().ToLower())
|
|
|
{
|
|
|
DataColumn dc = new DataColumn(MidDoc.Variables.FreeVariables.Item(j + 1).Name);
|
|
|
MidBoxCacheData.Columns.Add(dc);
|
|
|
@@ -1729,7 +1766,7 @@ namespace UAS_LabelMachine
|
|
|
for (int k = 0; k < MidLabelParam.Rows.Count; k++)
|
|
|
{
|
|
|
//名称相等的时候,取SQL进行值的查询
|
|
|
- if (MidDoc.Variables.FreeVariables.Item(j + 1).Name == MidLabelParam.Rows[k]["lp_name"].ToString())
|
|
|
+ if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() == MidLabelParam.Rows[k]["lp_name"].ToString().ToLower())
|
|
|
{
|
|
|
//获取对应行的pib_id
|
|
|
string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
@@ -1747,7 +1784,27 @@ namespace UAS_LabelMachine
|
|
|
else
|
|
|
{
|
|
|
DataRow[] dr = MidBoxCacheData.Select("pib_outboxcode1='" + pib_outboxcode1 + "'");
|
|
|
- if (arg.Contains(MidDoc.Variables.FreeVariables.Item(j + 1).Name))
|
|
|
+ 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 (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("产地"))
|
|
|
+ {
|
|
|
+ if (LabelInf.Rows[rowindex].Cells["pib_madein"].Value != null)
|
|
|
+ MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_madein"].Value.ToString();
|
|
|
+ }
|
|
|
+ else if (arg.Contains(MidDoc.Variables.FreeVariables.Item(j + 1).Name))
|
|
|
{
|
|
|
if (dr.Length > 0)
|
|
|
{
|
|
|
@@ -1785,7 +1842,7 @@ namespace UAS_LabelMachine
|
|
|
for (int k = 0; k < MidLabelParam.Rows.Count; k++)
|
|
|
{
|
|
|
//名称相等的时候,取SQL进行值的查询
|
|
|
- if (MidDoc.Variables.FreeVariables.Item(j + 1).Name == MidLabelParam.Rows[k]["lp_name"].ToString())
|
|
|
+ if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() == MidLabelParam.Rows[k]["lp_name"].ToString().ToLower())
|
|
|
{
|
|
|
//获取对应行的pib_id
|
|
|
string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
@@ -1851,7 +1908,7 @@ namespace UAS_LabelMachine
|
|
|
for (int k = 0; k < OutLabelParam.Rows.Count; k++)
|
|
|
{
|
|
|
//名称相等的时候,取SQL进行值的查询
|
|
|
- if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name == OutLabelParam.Rows[k]["lp_name"].ToString())
|
|
|
+ if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() == OutLabelParam.Rows[k]["lp_name"].ToString().ToLower())
|
|
|
{
|
|
|
//获取对应行的pib_id
|
|
|
string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
@@ -2187,20 +2244,23 @@ namespace UAS_LabelMachine
|
|
|
/// <param name="e"></param>
|
|
|
private void LabelInf_CellValueChanged(object sender, DataGridViewCellEventArgs e)
|
|
|
{
|
|
|
- if (LabelInf.Columns[e.ColumnIndex].Name == "pib_datecode")
|
|
|
+ if (e.RowIndex >= 0)
|
|
|
{
|
|
|
- string datecode = LabelInf.Rows[e.RowIndex].Cells["pib_datecode"].Value.ToString();
|
|
|
- try
|
|
|
+ if (LabelInf.Columns[e.ColumnIndex].Name == "pib_datecode")
|
|
|
{
|
|
|
- System.DateTime dt = System.DateTime.ParseExact(datecode, "yyyyMMdd", CultureInfo.CurrentCulture);
|
|
|
- GregorianCalendar gc = new GregorianCalendar();
|
|
|
- int weekOfYear = gc.GetWeekOfYear(dt, CalendarWeekRule.FirstDay, DayOfWeek.Monday);
|
|
|
- if (weekOfYear < 10)
|
|
|
- LabelInf.Rows[e.RowIndex].Cells["pib_datecode1"].Value = dt.Year.ToString().Substring(2, 2) + "0" + weekOfYear;
|
|
|
- else
|
|
|
- LabelInf.Rows[e.RowIndex].Cells["pib_datecode1"].Value = dt.Year.ToString().Substring(2, 2) + weekOfYear;
|
|
|
+ string datecode = LabelInf.Rows[e.RowIndex].Cells["pib_datecode"].Value.ToString();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ System.DateTime dt = System.DateTime.ParseExact(datecode, "yyyyMMdd", CultureInfo.CurrentCulture);
|
|
|
+ GregorianCalendar gc = new GregorianCalendar();
|
|
|
+ int weekOfYear = gc.GetWeekOfYear(dt, CalendarWeekRule.FirstDay, DayOfWeek.Monday);
|
|
|
+ if (weekOfYear < 10)
|
|
|
+ LabelInf.Rows[e.RowIndex].Cells["pib_datecode1"].Value = dt.Year.ToString().Substring(2, 2) + "0" + weekOfYear;
|
|
|
+ else
|
|
|
+ LabelInf.Rows[e.RowIndex].Cells["pib_datecode1"].Value = dt.Year.ToString().Substring(2, 2) + weekOfYear;
|
|
|
+ }
|
|
|
+ catch (Exception) { }
|
|
|
}
|
|
|
- catch (Exception) { }
|
|
|
}
|
|
|
}
|
|
|
|