|
@@ -26,8 +26,6 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
AccessDBHelper adh;
|
|
|
|
|
|
- AccessDBHelper front_adh;
|
|
|
-
|
|
|
AccessDBHelper back_adh;
|
|
|
|
|
|
DataTable dt;
|
|
@@ -139,7 +137,6 @@ namespace UAS_LabelMachine
|
|
|
LogManager.DoLog("程序启动,登陆人员【" + User.UserName + "】");
|
|
|
dh = SystemInf.dh;
|
|
|
adh = SystemInf.adh;
|
|
|
- front_adh = SystemInf.front_adh;
|
|
|
back_adh = SystemInf.back_adh;
|
|
|
CheckForIllegalCrossThreadCalls = false;
|
|
|
pi_inoutno.Focus();
|
|
@@ -359,6 +356,7 @@ namespace UAS_LabelMachine
|
|
|
AutoPrintMidLabel();
|
|
|
LogicHandler.SendDataToPLC(PLC1, PLCInstruct.FrontDataPass, adh);
|
|
|
LabelInf.Invalidate();
|
|
|
+ RefreshProcessData();
|
|
|
}
|
|
|
break;
|
|
|
case "BackendCheck":
|
|
@@ -469,7 +467,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
sql += "and pib_ifrecheck=0";
|
|
|
}
|
|
|
- Console.WriteLine(adh.getRowCount("prodiobarcode","pib_ifrecheck=-1"));
|
|
|
DataTable pndt = (DataTable)adh.ExecuteSql(sql, "select");
|
|
|
if (pndt.Rows[0][0].ToString() != "")
|
|
|
{
|
|
@@ -538,7 +535,6 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- Console.WriteLine("行号"+rownum);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -560,9 +556,6 @@ namespace UAS_LabelMachine
|
|
|
private bool FrontCheckFunction(string msg, out string ErrorMsg)
|
|
|
{
|
|
|
ErrorMsg = "";
|
|
|
- string year = "0";
|
|
|
- string month = "0";
|
|
|
- string day = "0";
|
|
|
|
|
|
RegexMatch("FrontCheck", msg, out ErrorMsg);
|
|
|
if (ErrorMsg != "")
|
|
@@ -573,180 +566,10 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value = DateCode;
|
|
|
-
|
|
|
- try
|
|
|
- {
|
|
|
- LogicHandler.GetTimeFromDatecode(DateCode, "", out year, out month, out day);
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_year"].Value = year;
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_month"].Value = month;
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_day"].Value = day;
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
|
|
|
- }
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value = LotNo;
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_ifmodify"].Value = true;
|
|
|
- string boxcode = front_adh.getFieldDataByCondition("prodiobarcode", "max(pib_outboxcode1)", "pib_inoutno='" + pi_inoutno.Text + "'").ToString();
|
|
|
- int outboxcode1 = int.Parse(Process_midboxcode.Text == "" ? "1" : Process_midboxcode.Text);
|
|
|
- boxcode = front_adh.getFieldDataByCondition("prodiobarcode", "max(pib_outboxcode2)", "pib_inoutno='" + pi_inoutno.Text + "'").ToString();
|
|
|
- int outboxcode2 = int.Parse(Process_outboxcode.Text == "" ? "1" : Process_outboxcode.Text);
|
|
|
- string pd_id = LabelInf.Rows[CurrentRowIndex].Cells["pd_id"].Value.ToString();
|
|
|
-
|
|
|
- bool GetBarcode = false;
|
|
|
-
|
|
|
- if (front_adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + outboxcode1) >= MidBoxCapacity.Value)
|
|
|
- {
|
|
|
- outboxcode1 = outboxcode1 + 1;
|
|
|
- GetBarcode = true;
|
|
|
- LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
- LogicHandler.SendDataToPLC(PLC1, PLCInstruct.MaterialTray, front_adh);
|
|
|
- }
|
|
|
-
|
|
|
- int CurrentRowNum = int.Parse(LabelInf.Rows[CurrentRowIndex].Cells["rownum"].Value.ToString());
|
|
|
-
|
|
|
- DataTable LastRowData = null;
|
|
|
- if (CurrentRowNum - 1 > 0)
|
|
|
- {
|
|
|
- LastRowData = (DataTable)front_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");
|
|
|
-
|
|
|
- if (cu_print_midlotno.Checked)
|
|
|
- {
|
|
|
- string TempData = LastRowData.Rows[0]["pib_lotno"].ToString();
|
|
|
- if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString() && !GetBarcode)
|
|
|
- {
|
|
|
- LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
- LogicHandler.SendDataToPLC(PLC1, PLCInstruct.MaterialTray, front_adh);
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_custmidboxcode"].Value = MidBoxBarCode;
|
|
|
- outboxcode1 = outboxcode1 + 1;
|
|
|
- }
|
|
|
- }
|
|
|
- else if (cu_print_midpo.Checked)
|
|
|
- {
|
|
|
- string TempData = LastRowData.Rows[0]["pd_pocode"].ToString();
|
|
|
- if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pd_pocode"].Value.ToString() && !GetBarcode)
|
|
|
- {
|
|
|
- LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
- LogicHandler.SendDataToPLC(PLC1, PLCInstruct.MaterialTray, front_adh);
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_custmidboxcode"].Value = MidBoxBarCode;
|
|
|
- outboxcode1 = outboxcode1 + 1;
|
|
|
- }
|
|
|
- }
|
|
|
- else if (cu_print_midprod.Checked)
|
|
|
- {
|
|
|
- string TempData = LastRowData.Rows[0]["pd_custprodcode"].ToString();
|
|
|
- if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodcode"].Value.ToString() && !GetBarcode)
|
|
|
- {
|
|
|
- LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
- LogicHandler.SendDataToPLC(PLC1, PLCInstruct.MaterialTray, front_adh);
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_custmidboxcode"].Value = MidBoxBarCode;
|
|
|
- outboxcode1 = outboxcode1 + 1;
|
|
|
- }
|
|
|
- }
|
|
|
- else if (cu_print_midspec.Checked)
|
|
|
- {
|
|
|
- string TempData = LastRowData.Rows[0]["pd_custprodspec"].ToString();
|
|
|
- if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodspec"].Value.ToString() && !GetBarcode)
|
|
|
- {
|
|
|
- LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
- LogicHandler.SendDataToPLC(PLC1, PLCInstruct.MaterialTray, front_adh);
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_custmidboxcode"].Value = MidBoxBarCode;
|
|
|
- outboxcode1 = outboxcode1 + 1;
|
|
|
- }
|
|
|
- }
|
|
|
- else if (cu_print_middc.Checked)
|
|
|
- {
|
|
|
- string TempData = LastRowData.Rows[0]["pib_datecode"].ToString();
|
|
|
- if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString() && !GetBarcode)
|
|
|
- {
|
|
|
- LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
- LogicHandler.SendDataToPLC(PLC1, PLCInstruct.MaterialTray, front_adh);
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_custmidboxcode"].Value = MidBoxBarCode;
|
|
|
- outboxcode1 = outboxcode1 + 1;
|
|
|
- }
|
|
|
- }
|
|
|
- if (LastRowData.Rows[0]["pib_custmidboxcode"].ToString() == MidBoxBarCode)
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_custmidboxcode"].Value = LastRowData.Rows[0]["pib_custmidboxcode"].ToString();
|
|
|
- else
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_custmidboxcode"].Value = MidBoxBarCode;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_custmidboxcode"].Value = MidBoxBarCode;
|
|
|
- }
|
|
|
- GetBarcode = false;
|
|
|
- if (front_adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2=" + outboxcode2) >= OutBoxCapacity.Value)
|
|
|
- {
|
|
|
- GetBarcode = true;
|
|
|
- outboxcode2 = outboxcode2 + 1;
|
|
|
- LogicHandler.GetBarCode(PI_ID, pd_id, 1, out OutBoxBarCode);
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_custoutboxcode"].Value = OutBoxBarCode;
|
|
|
- }
|
|
|
- else if (CurrentRowNum - 1 > 0)
|
|
|
- {
|
|
|
-
|
|
|
- if (cu_print_outlotno.Checked)
|
|
|
- {
|
|
|
- string TempData = LastRowData.Rows[0]["pib_lotno"].ToString();
|
|
|
- if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString() && !GetBarcode)
|
|
|
- {
|
|
|
- LogicHandler.GetBarCode(PI_ID, pd_id, 1, out OutBoxBarCode);
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_custoutboxcode"].Value = OutBoxBarCode;
|
|
|
- }
|
|
|
- }
|
|
|
- else if (cu_print_outpo.Checked)
|
|
|
- {
|
|
|
- string TempData = LastRowData.Rows[0]["pd_pocode"].ToString();
|
|
|
- if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pd_pocode"].Value.ToString() && !GetBarcode)
|
|
|
- {
|
|
|
- LogicHandler.GetBarCode(PI_ID, pd_id, 1, out OutBoxBarCode);
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_custoutboxcode"].Value = OutBoxBarCode;
|
|
|
- }
|
|
|
- }
|
|
|
- else if (cu_print_outprod.Checked)
|
|
|
- {
|
|
|
- string TempData = LastRowData.Rows[0]["pd_custprodcode"].ToString();
|
|
|
- if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodcode"].Value.ToString() && !GetBarcode)
|
|
|
- {
|
|
|
- LogicHandler.GetBarCode(PI_ID, pd_id, 1, out OutBoxBarCode);
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_custoutboxcode"].Value = OutBoxBarCode;
|
|
|
- }
|
|
|
- }
|
|
|
- else if (cu_print_outspec.Checked)
|
|
|
- {
|
|
|
- string TempData = LastRowData.Rows[0]["pd_custprodspec"].ToString();
|
|
|
- if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodspec"].Value.ToString() && !GetBarcode)
|
|
|
- {
|
|
|
- LogicHandler.GetBarCode(PI_ID, pd_id, 1, out OutBoxBarCode);
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_custoutboxcode"].Value = OutBoxBarCode;
|
|
|
- }
|
|
|
- }
|
|
|
- else if (cu_print_outdc.Checked)
|
|
|
- {
|
|
|
- string TempData = LastRowData.Rows[0]["pib_datecode"].ToString();
|
|
|
- if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString() && !GetBarcode)
|
|
|
- {
|
|
|
- LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_custoutboxcode"].Value = OutBoxBarCode;
|
|
|
- }
|
|
|
- }
|
|
|
- if (OutBoxBarCode == LastRowData.Rows[0]["pib_custoutboxcode"].ToString())
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_custoutboxcode"].Value = LastRowData.Rows[0]["pib_custoutboxcode"].ToString();
|
|
|
- else
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_custoutboxcode"].Value = OutBoxBarCode;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- LogicHandler.GetBarCode(PI_ID, pd_id, 1, out OutBoxBarCode);
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_custoutboxcode"].Value = OutBoxBarCode;
|
|
|
- }
|
|
|
-
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value = outboxcode1;
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode2"].Value = outboxcode2;
|
|
|
- string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
|
|
|
- front_adh.ExecuteSql("update prodiobarcode set pib_year=" + year + ",pib_month=" + month + ",pib_day=" + day + ",pib_outboxcode2=" + outboxcode2 + ",pib_outboxcode1=" + outboxcode1 + ",pib_custoutboxcode='" + OutBoxBarCode + "',pib_custmidboxcode='" + MidBoxBarCode + "',pib_lotno='" + LotNo + "',pib_datecode='" + DateCode + "',pib_ifpick=-1,pib_ifmodify=-1 where pib_id=" + pib_id, "update");
|
|
|
- LabelInf.Invalidate();
|
|
|
+ SetOutboxBarcode();
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
@@ -919,14 +742,13 @@ namespace UAS_LabelMachine
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_month"].Value = month;
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_day"].Value = day;
|
|
|
}
|
|
|
- catch (Exception){}
|
|
|
+ catch (Exception) { }
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value = LotNo;
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_ifmodify"].Value = true;
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_ifrecheck"].Value = true;
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_ifpick"].Value = true;
|
|
|
- back_adh.ExecuteSQLTran("update prodiobarcode set pib_year=" + year + ",pib_month=" + month + ",pib_day=" + day + ",pib_lotno='" + LotNo + "',pib_datecode='" + DateCode + "',pib_ifpick=-1,pib_ifmodify=-1,pib_ifrecheck=-1 where pib_id=" + LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value);
|
|
|
- Console.WriteLine("勾选行数"+ back_adh.getRowCount("prodiobarcode", "pib_ifrecheck=-1"));
|
|
|
- Console.WriteLine("勾选行数"+adh.getRowCount("prodiobarcode", "pib_ifrecheck=-1"));
|
|
|
+ adh.ExecuteSQLTran("update prodiobarcode set pib_year=" + year + ",pib_month=" + month + ",pib_day=" + day + ",pib_lotno='" + LotNo + "',pib_datecode='" + DateCode + "',pib_ifpick=-1,pib_ifmodify=-1,pib_ifrecheck=-1 where pib_id=" + LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value);
|
|
|
+ LogicHandler.CheckUploadData(pi_inoutno.Text, UploadNum);
|
|
|
LabelInf.Invalidate();
|
|
|
return true;
|
|
|
}
|
|
@@ -971,39 +793,12 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void AutoPrintSingleLabel()
|
|
|
+ private bool AutoPrintSingleLabel()
|
|
|
{
|
|
|
|
|
|
- string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
|
|
|
- sql.Clear();
|
|
|
- for (int i = 0; i < SingleDoc.Variables.FormVariables.Count; i++)
|
|
|
- {
|
|
|
- DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(i + 1).Name.ToLower() + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
- {
|
|
|
- sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
- }
|
|
|
- }
|
|
|
- sql.Append("1,");
|
|
|
- DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_id=" + pib_id, "select");
|
|
|
- for (int i = 0; i < SingleDoc.Variables.FormVariables.Count; i++)
|
|
|
- {
|
|
|
- DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(i + 1).Name.ToLower() + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
- {
|
|
|
- SingleDoc.Variables.FormVariables.Item(i + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
- }
|
|
|
- if (SingleDoc.Variables.FormVariables.Item(i + 1).Value == "")
|
|
|
- {
|
|
|
- dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(i + 1).Name.ToLower() + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
- SingleDoc.Variables.FormVariables.Item(i + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
- }
|
|
|
- }
|
|
|
- SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
- SingleDoc.PrintDocument();
|
|
|
- LogicHandler.UpdateRowPrinted(pib_id);
|
|
|
+ SinglePrint(LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString());
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_ifprint"].Value = true;
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1135,7 +930,7 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
|
|
|
sql.Clear();
|
|
|
- sql.Append("select cu_print_middc,cu_print_outdc,cu_print_checkdatecode,cu_print_midlotno,nvl(cu_print_custprodmatchmodel,'Equal')cu_print_custprodmatchmodel,cu_print_midspec,cu_print_midpo,cu_print_midprod,cu_print_outlotno,cu_print_outspec,cu_print_outpo");
|
|
|
+ sql.Append("select cu_print_middc,cu_print_outdc,cu_print_dateformat,cu_print_checkdatecode,cu_print_midlotno,nvl(cu_print_custprodmatchmodel,'Equal')cu_print_custprodmatchmodel,cu_print_midspec,cu_print_midpo,cu_print_midprod,cu_print_outlotno,cu_print_outspec,cu_print_outpo");
|
|
|
sql.Append(",cu_print_outprod,cu_print_checkonly,nvl(cu_print_papercount,0)cu_print_papercount,cu_print_regexpression,cu_print_recheck from customer where cu_code='" + pi_cardcode.Text + "'");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
@@ -1188,8 +983,6 @@ namespace UAS_LabelMachine
|
|
|
SingleBoxArgument.Clear();
|
|
|
MidIDAndOutboxcode.Clear();
|
|
|
SingleID.Clear();
|
|
|
-
|
|
|
- RefreshProcessData();
|
|
|
thread = new Thread(GetInOutInfAndLabelFile);
|
|
|
stw = new SetLoadingWindow(thread, "正在获取打印标签");
|
|
|
BaseUtil.SetFormCenter(stw);
|
|
@@ -1289,35 +1082,7 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
try
|
|
|
{
|
|
|
- string pib_id = LabelInf.Rows[i].Cells["pib_id1"].Value.ToString();
|
|
|
- sql.Clear();
|
|
|
- for (int j = 0; j < SingleDoc.Variables.FormVariables.Count; j++)
|
|
|
- {
|
|
|
- DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
- {
|
|
|
- sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
- }
|
|
|
- }
|
|
|
- sql.Append("1,");
|
|
|
- DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_id=" + pib_id, "select");
|
|
|
- for (int j = 0; j < SingleDoc.Variables.FormVariables.Count; j++)
|
|
|
- {
|
|
|
- DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
- {
|
|
|
- SingleDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
- }
|
|
|
- if (SingleDoc.Variables.FormVariables.Item(j + 1).Value == "")
|
|
|
- {
|
|
|
- dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
- SingleDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
- }
|
|
|
- }
|
|
|
- SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
- SingleDoc.PrintDocument();
|
|
|
- LogicHandler.UpdateRowPrinted(pib_id);
|
|
|
+ SinglePrint(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString());
|
|
|
if (MidLabelAutoPrint.Checked)
|
|
|
{
|
|
|
|
|
@@ -1338,7 +1103,6 @@ namespace UAS_LabelMachine
|
|
|
catch (Exception ex) { LogManager.DoLog(ex.Message); }
|
|
|
}
|
|
|
}
|
|
|
- dh.BatchInsert("update prodiobarcode set pib_printdate=sysdate where pib_id=:pib_id", new string[] { "pib_id" }, SingleID.ToArray());
|
|
|
if (CheckedRowCount == 0)
|
|
|
MessageBox.Show("未勾选打印明细!");
|
|
|
else if (CurrentRowIndex + 1 < LabelInf.Rows.Count)
|
|
@@ -1822,6 +1586,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
|
|
|
ScanGroup = (DataTable)dh.ExecuteSql("select distinct sg_brand,sg_id,sg_name,sg_script from prodiobarcode left join scangroup on pib_brand=sg_brand where pib_inoutno='" + pi_inoutno.Text + "' and sg_id is not null and nvl(sg_autolabel,0)=0", "select");
|
|
|
+ RefreshProcessData();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -2505,37 +2270,237 @@ namespace UAS_LabelMachine
|
|
|
DataTable pibid_dt = (DataTable)adh.ExecuteSql("select pib_id from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno=" + pdno, "select");
|
|
|
for (int i = 0; i < pibid_dt.Rows.Count; i++)
|
|
|
{
|
|
|
- string pib_id = pibid_dt.Rows[i]["pib_id"].ToString();
|
|
|
- sql.Clear();
|
|
|
- for (int j = 0; j < SingleDoc.Variables.FormVariables.Count; j++)
|
|
|
+ SinglePrint(pibid_dt.Rows[i]["pib_id1"].ToString());
|
|
|
+ }
|
|
|
+ setvalueandprint.FindForm().Close();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private void ResetBarcode_Click(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ string close = MessageBox.Show(this.ParentForm, "是否重置本单据条码", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
|
|
|
+ if (close == "Yes")
|
|
|
+ {
|
|
|
+ dh.ExecuteSql("delete from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "'", "delete");
|
|
|
+ adh.ExecuteSql("delete from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "'", "delete");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void SetOutboxBarcode()
|
|
|
+ {
|
|
|
+ string year = "0";
|
|
|
+ string month = "0";
|
|
|
+ string day = "0";
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ LogicHandler.GetTimeFromDatecode(DateCode, "", out year, out month, out day);
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_year"].Value = year;
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_month"].Value = month;
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_day"].Value = day;
|
|
|
+ }
|
|
|
+ catch (Exception) { }
|
|
|
+ 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();
|
|
|
+
|
|
|
+ bool GetBarcode = false;
|
|
|
+
|
|
|
+ if (adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + outboxcode1) >= MidBoxCapacity.Value)
|
|
|
+ {
|
|
|
+ outboxcode1 = outboxcode1 + 1;
|
|
|
+ GetBarcode = true;
|
|
|
+ LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
+ LogicHandler.SendDataToPLC(PLC1, PLCInstruct.MaterialTray, adh);
|
|
|
+ }
|
|
|
+
|
|
|
+ int CurrentRowNum = int.Parse(LabelInf.Rows[CurrentRowIndex].Cells["rownum"].Value.ToString());
|
|
|
+
|
|
|
+ DataTable LastRowData = null;
|
|
|
+ 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");
|
|
|
+
|
|
|
+ if (cu_print_midlotno.Checked)
|
|
|
+ {
|
|
|
+ string TempData = LastRowData.Rows[0]["pib_lotno"].ToString();
|
|
|
+ if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString() && !GetBarcode)
|
|
|
+ {
|
|
|
+ LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
+ LogicHandler.SendDataToPLC(PLC1, PLCInstruct.MaterialTray, adh);
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_custmidboxcode"].Value = MidBoxBarCode;
|
|
|
+ outboxcode1 = outboxcode1 + 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (cu_print_midpo.Checked)
|
|
|
{
|
|
|
- DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
+ string TempData = LastRowData.Rows[0]["pd_pocode"].ToString();
|
|
|
+ if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pd_pocode"].Value.ToString() && !GetBarcode)
|
|
|
{
|
|
|
- sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
+ LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
+ LogicHandler.SendDataToPLC(PLC1, PLCInstruct.MaterialTray, adh);
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_custmidboxcode"].Value = MidBoxBarCode;
|
|
|
+ outboxcode1 = outboxcode1 + 1;
|
|
|
}
|
|
|
}
|
|
|
- sql.Append("1,");
|
|
|
- DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_id=" + pib_id, "select");
|
|
|
- for (int j = 0; j < SingleDoc.Variables.FormVariables.Count; j++)
|
|
|
+ else if (cu_print_midprod.Checked)
|
|
|
{
|
|
|
- DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
+ string TempData = LastRowData.Rows[0]["pd_custprodcode"].ToString();
|
|
|
+ if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodcode"].Value.ToString() && !GetBarcode)
|
|
|
{
|
|
|
- SingleDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
+ LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
+ LogicHandler.SendDataToPLC(PLC1, PLCInstruct.MaterialTray, adh);
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_custmidboxcode"].Value = MidBoxBarCode;
|
|
|
+ outboxcode1 = outboxcode1 + 1;
|
|
|
}
|
|
|
- if (SingleDoc.Variables.FormVariables.Item(j + 1).Value == "")
|
|
|
+ }
|
|
|
+ else if (cu_print_midspec.Checked)
|
|
|
+ {
|
|
|
+ string TempData = LastRowData.Rows[0]["pd_custprodspec"].ToString();
|
|
|
+ if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodspec"].Value.ToString() && !GetBarcode)
|
|
|
{
|
|
|
- dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
- SingleDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
+ LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
+ LogicHandler.SendDataToPLC(PLC1, PLCInstruct.MaterialTray, adh);
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_custmidboxcode"].Value = MidBoxBarCode;
|
|
|
+ outboxcode1 = outboxcode1 + 1;
|
|
|
}
|
|
|
}
|
|
|
- SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
- SingleDoc.PrintDocument();
|
|
|
- LogicHandler.UpdateRowPrinted(pib_id);
|
|
|
+ else if (cu_print_middc.Checked)
|
|
|
+ {
|
|
|
+ string TempData = LastRowData.Rows[0]["pib_datecode"].ToString();
|
|
|
+ if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString() && !GetBarcode)
|
|
|
+ {
|
|
|
+ LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
+ LogicHandler.SendDataToPLC(PLC1, PLCInstruct.MaterialTray, adh);
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_custmidboxcode"].Value = MidBoxBarCode;
|
|
|
+ outboxcode1 = outboxcode1 + 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (LastRowData.Rows[0]["pib_custmidboxcode"].ToString() == MidBoxBarCode)
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_custmidboxcode"].Value = LastRowData.Rows[0]["pib_custmidboxcode"].ToString();
|
|
|
+ else
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_custmidboxcode"].Value = MidBoxBarCode;
|
|
|
}
|
|
|
- setvalueandprint.FindForm().Close();
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_custmidboxcode"].Value = MidBoxBarCode;
|
|
|
+ }
|
|
|
+ GetBarcode = false;
|
|
|
+ if (adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2=" + outboxcode2) >= OutBoxCapacity.Value)
|
|
|
+ {
|
|
|
+ GetBarcode = true;
|
|
|
+ outboxcode2 = outboxcode2 + 1;
|
|
|
+ LogicHandler.GetBarCode(PI_ID, pd_id, 1, out OutBoxBarCode);
|
|
|
+ Console.WriteLine("1" + OutBoxBarCode);
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_custoutboxcode"].Value = OutBoxBarCode;
|
|
|
+ }
|
|
|
+ else if (CurrentRowNum - 1 > 0)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (cu_print_outlotno.Checked)
|
|
|
+ {
|
|
|
+ string TempData = LastRowData.Rows[0]["pib_lotno"].ToString();
|
|
|
+ if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString() && !GetBarcode)
|
|
|
+ {
|
|
|
+ LogicHandler.GetBarCode(PI_ID, pd_id, 1, out OutBoxBarCode);
|
|
|
+ Console.WriteLine("2" + OutBoxBarCode);
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_custoutboxcode"].Value = OutBoxBarCode;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (cu_print_outpo.Checked)
|
|
|
+ {
|
|
|
+ string TempData = LastRowData.Rows[0]["pd_pocode"].ToString();
|
|
|
+ if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pd_pocode"].Value.ToString() && !GetBarcode)
|
|
|
+ {
|
|
|
+ LogicHandler.GetBarCode(PI_ID, pd_id, 1, out OutBoxBarCode);
|
|
|
+ Console.WriteLine("3" + OutBoxBarCode);
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_custoutboxcode"].Value = OutBoxBarCode;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (cu_print_outprod.Checked)
|
|
|
+ {
|
|
|
+ string TempData = LastRowData.Rows[0]["pd_custprodcode"].ToString();
|
|
|
+ if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodcode"].Value.ToString() && !GetBarcode)
|
|
|
+ {
|
|
|
+ LogicHandler.GetBarCode(PI_ID, pd_id, 1, out OutBoxBarCode);
|
|
|
+ Console.WriteLine("4" + OutBoxBarCode);
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_custoutboxcode"].Value = OutBoxBarCode;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (cu_print_outspec.Checked)
|
|
|
+ {
|
|
|
+ string TempData = LastRowData.Rows[0]["pd_custprodspec"].ToString();
|
|
|
+ if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pd_custprodspec"].Value.ToString() && !GetBarcode)
|
|
|
+ {
|
|
|
+ LogicHandler.GetBarCode(PI_ID, pd_id, 1, out OutBoxBarCode);
|
|
|
+ Console.WriteLine("5" + OutBoxBarCode);
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_custoutboxcode"].Value = OutBoxBarCode;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (cu_print_outdc.Checked)
|
|
|
+ {
|
|
|
+ string TempData = LastRowData.Rows[0]["pib_datecode"].ToString();
|
|
|
+ if (TempData != "" && TempData != LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString() && !GetBarcode)
|
|
|
+ {
|
|
|
+ LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
+ Console.WriteLine("6" + OutBoxBarCode);
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_custoutboxcode"].Value = OutBoxBarCode;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (OutBoxBarCode == LastRowData.Rows[0]["pib_custoutboxcode"].ToString())
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_custoutboxcode"].Value = LastRowData.Rows[0]["pib_custoutboxcode"].ToString();
|
|
|
+ else
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_custoutboxcode"].Value = OutBoxBarCode;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogicHandler.GetBarCode(PI_ID, pd_id, 1, out OutBoxBarCode);
|
|
|
+ Console.WriteLine("1" + OutBoxBarCode);
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_custoutboxcode"].Value = OutBoxBarCode;
|
|
|
+ }
|
|
|
+
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value = outboxcode1;
|
|
|
+ LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode2"].Value = outboxcode2;
|
|
|
+ string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
|
|
|
+ if (SingleLabelAutoPrint.Checked)
|
|
|
+ adh.ExecuteSql("update prodiobarcode set pib_year=" + year + ",pib_month=" + month + ",pib_day=" + day + ",pib_outboxcode2=" + outboxcode2 + ",pib_outboxcode1=" + outboxcode1 + ",pib_custoutboxcode='" + OutBoxBarCode + "',pib_custmidboxcode='" + MidBoxBarCode + "',pib_lotno='" + LotNo + "',pib_datecode='" + DateCode + "',pib_ifpick=-1,pib_ifmodify=-1,pib_ifprint=-1 where pib_id=" + pib_id, "update");
|
|
|
+ else
|
|
|
+ adh.ExecuteSql("update prodiobarcode set pib_year=" + year + ",pib_month=" + month + ",pib_day=" + day + ",pib_outboxcode2=" + outboxcode2 + ",pib_outboxcode1=" + outboxcode1 + ",pib_custoutboxcode='" + OutBoxBarCode + "',pib_custmidboxcode='" + MidBoxBarCode + "',pib_lotno='" + LotNo + "',pib_datecode='" + DateCode + "',pib_ifpick=-1,pib_ifmodify=-1 where pib_id=" + pib_id, "update");
|
|
|
+ LabelInf.Invalidate();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void SinglePrint(string pib_id)
|
|
|
+ {
|
|
|
+ sql.Clear();
|
|
|
+ for (int j = 0; j < SingleDoc.Variables.FormVariables.Count; j++)
|
|
|
+ {
|
|
|
+ DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
+ if (dr1.Length > 0)
|
|
|
+ {
|
|
|
+ sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sql.Append("1,");
|
|
|
+ DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_id=" + pib_id, "select");
|
|
|
+ for (int j = 0; j < SingleDoc.Variables.FormVariables.Count; j++)
|
|
|
+ {
|
|
|
+ DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
+ if (dr1.Length > 0)
|
|
|
+ {
|
|
|
+ SingleDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
+ }
|
|
|
+ if (SingleDoc.Variables.FormVariables.Item(j + 1).Value == "")
|
|
|
+ {
|
|
|
+ dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
+ if (dr1.Length > 0)
|
|
|
+ SingleDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
+ SingleDoc.PrintDocument();
|
|
|
+ LogicHandler.UpdateRowPrinted(pib_id);
|
|
|
}
|
|
|
}
|
|
|
}
|