|
|
@@ -24,6 +24,8 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
DataHelper dh;
|
|
|
|
|
|
+ DataHelper dh1;
|
|
|
+
|
|
|
AccessDBHelper adh;
|
|
|
|
|
|
AccessDBHelper back_adh;
|
|
|
@@ -136,6 +138,7 @@ namespace UAS_LabelMachine
|
|
|
//用计时器重置数据库链接
|
|
|
LogManager.DoLog("程序启动,登陆人员【" + User.UserName + "】");
|
|
|
dh = SystemInf.dh;
|
|
|
+ dh1 = SystemInf.dh1;
|
|
|
adh = SystemInf.adh;
|
|
|
back_adh = SystemInf.back_adh;
|
|
|
CheckForIllegalCrossThreadCalls = false;
|
|
|
@@ -360,7 +363,6 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
break;
|
|
|
case "BackendCheck":
|
|
|
-
|
|
|
BackCheck.Text = msg;
|
|
|
if (BackendCheckFunction(msg, "Auto", out ErrorMsg))
|
|
|
{
|
|
|
@@ -460,7 +462,7 @@ namespace UAS_LabelMachine
|
|
|
string month = "";
|
|
|
string day = "";
|
|
|
string date = "";
|
|
|
- LogicHandler.GetTimeFromDatecode(DateCode, pi_cardcode.Text, out year, out month, out day, out date);
|
|
|
+ LogicHandler.GetTimeFromDatecode(dh,DateCode, pi_cardcode.Text, out year, out month, out day, out date);
|
|
|
System.DateTime dtime;
|
|
|
//有效期比对
|
|
|
if (System.DateTime.TryParseExact(date, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dtime))
|
|
|
@@ -700,7 +702,7 @@ namespace UAS_LabelMachine
|
|
|
dr[0]["pib_datecode"] = DateCode;
|
|
|
try
|
|
|
{
|
|
|
- LogicHandler.GetTimeFromDatecode(DateCode, pi_cardcode.Text, out year, out month, out day, out date);
|
|
|
+ LogicHandler.GetTimeFromDatecode(dh1,DateCode, pi_cardcode.Text, out year, out month, out day, out date);
|
|
|
dr[0]["pib_year"] = year;
|
|
|
dr[0]["pib_month"] = month;
|
|
|
dr[0]["pib_day"] = day;
|
|
|
@@ -776,7 +778,7 @@ namespace UAS_LabelMachine
|
|
|
//解析DateCode,将值设置到年月日
|
|
|
try
|
|
|
{
|
|
|
- LogicHandler.GetTimeFromDatecode(DateCode, pi_cardcode.Text, out year, out month, out day, out date);
|
|
|
+ LogicHandler.GetTimeFromDatecode(dh1,DateCode, pi_cardcode.Text, out year, out month, out day, out date);
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_year"].Value = year;
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_month"].Value = month;
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_day"].Value = day;
|
|
|
@@ -1368,6 +1370,8 @@ namespace UAS_LabelMachine
|
|
|
for (int j = 0; j < MidDoc.Variables.FormVariables.Count; j++)
|
|
|
{
|
|
|
DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|
|
|
+ if (dr1.Length == 0)
|
|
|
+ dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name.Replace("_1", "") + "'");
|
|
|
if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
|
|
|
{
|
|
|
MidDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
@@ -1380,12 +1384,12 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
for (int k = 0; k < MidDoc.Variables.FormVariables.Count; k++)
|
|
|
{
|
|
|
- if (i == 0 & MidDoc.Variables.FormVariables.Item(k + 1).Name.ToUpper() == dr1[0]["lp_name"].ToString().ToUpper())
|
|
|
+ if (i == 0 & MidDoc.Variables.FormVariables.Item(k + 1).Name == dr1[0]["lp_name"].ToString())
|
|
|
{
|
|
|
MidDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[0][0].ToString();
|
|
|
}
|
|
|
//使用SN开头的参数赋值SN1,SN2,SN3等参数
|
|
|
- if (MidDoc.Variables.FormVariables.Item(k + 1).Name.ToUpper() == (dr1[0]["lp_name"].ToString() + (i + 1)).ToUpper())
|
|
|
+ if (MidDoc.Variables.FormVariables.Item(k + 1).Name == (dr1[0]["lp_name"].ToString() + "_" + (i + 1)))
|
|
|
{
|
|
|
MidDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[i][0].ToString();
|
|
|
}
|
|
|
@@ -1455,6 +1459,9 @@ namespace UAS_LabelMachine
|
|
|
for (int j = 0; j < OutBoxDoc.Variables.FormVariables.Count; j++)
|
|
|
{
|
|
|
DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|
|
|
+ //多参数命名
|
|
|
+ if (dr1.Length == 0)
|
|
|
+ dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name.Replace("_1", "") + "'");
|
|
|
if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
|
|
|
{
|
|
|
OutBoxDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
@@ -1467,12 +1474,12 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
for (int k = 0; k < OutBoxDoc.Variables.FormVariables.Count; k++)
|
|
|
{
|
|
|
- if (i == 0 & OutBoxDoc.Variables.FormVariables.Item(k + 1).Name.ToUpper() == dr1[0]["lp_name"].ToString().ToUpper())
|
|
|
+ if (i == 0 & OutBoxDoc.Variables.FormVariables.Item(k + 1).Name == dr1[0]["lp_name"].ToString())
|
|
|
{
|
|
|
OutBoxDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[0][0].ToString();
|
|
|
}
|
|
|
//使用SN开头的参数赋值SN1,SN2,SN3等参数
|
|
|
- if (OutBoxDoc.Variables.FormVariables.Item(k + 1).Name.ToUpper() == (dr1[0]["lp_name"].ToString() + (i + 1)).ToUpper())
|
|
|
+ if (OutBoxDoc.Variables.FormVariables.Item(k + 1).Name == (dr1[0]["lp_name"].ToString() + "_" + (i + 1)))
|
|
|
{
|
|
|
OutBoxDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[i][0].ToString();
|
|
|
}
|
|
|
@@ -1900,7 +1907,7 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
private void RefreshDBConnect_Tick(object sender, EventArgs e)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void ButtonSetting_Click(object sender, EventArgs e)
|
|
|
@@ -2315,7 +2322,7 @@ namespace UAS_LabelMachine
|
|
|
string month = "0";
|
|
|
string day = "0";
|
|
|
string date = "";
|
|
|
- LogicHandler.GetTimeFromDatecode(datecode, pi_cardcode.Text, out year, out month, out day, out date);
|
|
|
+ LogicHandler.GetTimeFromDatecode(dh1,datecode, pi_cardcode.Text, out year, out month, out day, out date);
|
|
|
adh.ExecuteSql("update prodiobarcode set pib_ifpick=-1,pib_ifmodify=-1,pib_lotno='" + lotno + "',pib_datecode='" + datecode + "',pib_year='" + year + "',pib_month='" + month + "',pib_day='" + day + "' where pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno=" + pdno, "update");
|
|
|
LoadGridData();
|
|
|
setvalue.FindForm().Close();
|
|
|
@@ -2331,7 +2338,7 @@ namespace UAS_LabelMachine
|
|
|
string month = "0";
|
|
|
string day = "0";
|
|
|
string date = "";
|
|
|
- LogicHandler.GetTimeFromDatecode(datecode, pi_cardcode.Text, out year, out month, out day, out date);
|
|
|
+ LogicHandler.GetTimeFromDatecode(dh1,datecode, pi_cardcode.Text, out year, out month, out day, out date);
|
|
|
adh.ExecuteSql("update prodiobarcode set pib_ifpick=-1,pib_ifmodify=-1,pib_ifprint=-1,pib_lotno='" + lotno + "',pib_datecode='" + datecode + "',pib_year='" + year + "',pib_month='" + month + "',pib_day='" + day + "' where pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno=" + pdno, "update");
|
|
|
LoadGridData();
|
|
|
DataTable pibid_dt = (DataTable)adh.ExecuteSql("select pib_id from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno=" + pdno, "select");
|
|
|
@@ -2361,7 +2368,7 @@ namespace UAS_LabelMachine
|
|
|
//解析DateCode,将值设置到年月日
|
|
|
try
|
|
|
{
|
|
|
- LogicHandler.GetTimeFromDatecode(DateCode, pi_cardcode.Text, out year, out month, out day, out date);
|
|
|
+ LogicHandler.GetTimeFromDatecode(dh,DateCode, pi_cardcode.Text, out year, out month, out day, out date);
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_year"].Value = year;
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_month"].Value = month;
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_day"].Value = day;
|
|
|
@@ -2370,8 +2377,6 @@ namespace UAS_LabelMachine
|
|
|
int outboxcode1 = int.Parse(Process_midboxcode.Text == "" ? "1" : Process_midboxcode.Text);
|
|
|
int outboxcode2 = int.Parse(Process_outboxcode.Text == "" ? "1" : Process_outboxcode.Text);
|
|
|
string pd_id = LabelInf.Rows[CurrentRowIndex].Cells["pd_id"].Value.ToString();
|
|
|
- //获取上一行的数据
|
|
|
- DataTable LastRowData = null;
|
|
|
//如果满容量获取过箱号就不再重复获取了
|
|
|
bool GetBarcode = false;
|
|
|
//获取当前的行号
|
|
|
@@ -2387,7 +2392,8 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
else if (CurrentRowNum - 1 > 0)
|
|
|
{
|
|
|
- LastRowData = (DataTable)adh.ExecuteSql("select pib_lotno,pib_custmidboxcode,pib_custoutboxcode,pd_pocode,pd_custprodcode,pd_custprodspec,pib_datecode from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and rownum=" + (CurrentRowNum - 1), "select");
|
|
|
+ //获取上一行的数据
|
|
|
+ DataTable LastRowData = (DataTable)adh.ExecuteSql("select pib_lotno,pib_custmidboxcode,pib_custoutboxcode,pd_pocode,pd_custprodcode,pd_custprodspec,pib_datecode from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and rownum=" + (CurrentRowNum - 1), "select");
|
|
|
string custmidboxcode = LastRowData.Rows[0]["pib_custmidboxcode"].ToString();
|
|
|
if (custmidboxcode == "")
|
|
|
{
|
|
|
@@ -2470,7 +2476,8 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
else if (CurrentRowNum - 1 > 0)
|
|
|
{
|
|
|
- LastRowData = (DataTable)adh.ExecuteSql("select pib_lotno,pib_custmidboxcode,pib_custoutboxcode,pd_pocode,pd_custprodcode,pd_custprodspec,pib_datecode from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and rownum=" + (CurrentRowNum - 1), "select");
|
|
|
+ //获取上一行数据
|
|
|
+ DataTable LastRowData = (DataTable)adh.ExecuteSql("select pib_lotno,pib_custmidboxcode,pib_custoutboxcode,pd_pocode,pd_custprodcode,pd_custprodspec,pib_datecode from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and rownum=" + (CurrentRowNum - 1), "select");
|
|
|
string custoutboxcode = LastRowData.Rows[0]["pib_custoutboxcode"].ToString();
|
|
|
if (custoutboxcode == "")
|
|
|
{
|
|
|
@@ -2559,7 +2566,6 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
sql.Append("1,");
|
|
|
DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_id=" + pib_id, "select");
|
|
|
- Console.WriteLine("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_id=" + pib_id);
|
|
|
for (int j = 0; j < SingleDoc.Variables.FormVariables.Count; j++)
|
|
|
{
|
|
|
DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|