|
|
@@ -368,6 +368,11 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
ErrorMsg = "订单号不匹配";
|
|
|
}
|
|
|
+ //如果品牌不对应的话则不能使用本次的匹配规则
|
|
|
+ if (LabelInfDataTable.Rows[CurrentRowIndex]["pib_brand"].ToString() != sg_brand)
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -398,7 +403,7 @@ namespace UAS_LabelMachine
|
|
|
private void BackendCheckFunction(string msg, string pib_id)
|
|
|
{
|
|
|
DataTable dtt = LabelInf.DataSource as DataTable;
|
|
|
- string[] msgArr = msg.Split('@');
|
|
|
+ string[] msgArr = msg.Split(back_sg_separator.Text.ToCharArray());
|
|
|
//需要校验2项数据,完成校验后此项的值需要为2则表示校验成功
|
|
|
int checkItemCount = 0;
|
|
|
for (int i = 0; i < msgArr.Length; i++)
|
|
|
@@ -497,6 +502,15 @@ namespace UAS_LabelMachine
|
|
|
outboxcode1 = outboxcode1 + 1;
|
|
|
}
|
|
|
}
|
|
|
+ else if (cu_print_middc.Checked)
|
|
|
+ {
|
|
|
+ if (LabelInf.Rows[CurrentRowIndex - 1].Cells["pib_datecode"].Value.ToString() != LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString())
|
|
|
+ {
|
|
|
+ LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
+ LabelInfDataTable.Rows[CurrentRowIndex]["pib_custmidboxcode"] = MidBoxBarCode;
|
|
|
+ outboxcode1 = outboxcode1 + 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
if (MidBoxBarCode == "")
|
|
|
{
|
|
|
LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
@@ -544,6 +558,14 @@ namespace UAS_LabelMachine
|
|
|
LabelInfDataTable.Rows[CurrentRowIndex]["pib_custoutboxcode"] = OutBoxBarCode;
|
|
|
}
|
|
|
}
|
|
|
+ else if (cu_print_outdc.Checked)
|
|
|
+ {
|
|
|
+ if (LabelInf.Rows[CurrentRowIndex - 1].Cells["pib_datecode"].Value.ToString() != LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString())
|
|
|
+ {
|
|
|
+ LogicHandler.GetBarCode(PI_ID, pd_id, 1, out MidBoxBarCode);
|
|
|
+ LabelInfDataTable.Rows[CurrentRowIndex]["pib_custoutboxcode"] = OutBoxBarCode;
|
|
|
+ }
|
|
|
+ }
|
|
|
if (OutBoxBarCode == "")
|
|
|
{
|
|
|
LogicHandler.GetBarCode(PI_ID, pd_id, 1, out OutBoxBarCode);
|
|
|
@@ -613,15 +635,13 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
//用标签本身的变量作为最外层的循环条件去匹配;
|
|
|
string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
|
|
|
+ sql.Clear();
|
|
|
for (int i = 0; i < SingleDoc.Variables.FreeVariables.Count; i++)
|
|
|
{
|
|
|
DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(i + 1).Name.ToLower() + "'");
|
|
|
if (dr1.Length > 0)
|
|
|
{
|
|
|
- if (i != SingleDoc.Variables.FreeVariables.Count - 1)
|
|
|
- sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
- else
|
|
|
- sql.Append(dr1[0]["lp_sql"].ToString());
|
|
|
+ sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
}
|
|
|
}
|
|
|
DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_id=" + pib_id, "select");
|
|
|
@@ -774,7 +794,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
//获取客户自定义设置
|
|
|
sql.Clear();
|
|
|
- sql.Append("select 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_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)
|
|
|
@@ -812,8 +832,8 @@ namespace UAS_LabelMachine
|
|
|
sql.Append("where pd_inoutno='" + pi_inoutno.Text + "' and si_enable=-1 group by sg_id,sg_script,sg_brand,si_item,sg_name,si_name,sg_step order by sg_step,itemindex ");
|
|
|
ScanItem = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
sql.Clear();
|
|
|
- sql.Append("select distinct sg_brand from prodiodetail left join product on pd_prodcode=pr_code left ");
|
|
|
- sql.Append("join scangroup on nvl(pd_brand,pr_brand)=sg_brand where pd_inoutno='" + pi_inoutno.Text + "'");
|
|
|
+ sql.Append("select distinct sg_brand from prodiodetail left join product on pd_prodcode=pr_code left join scangroup ");
|
|
|
+ sql.Append("on nvl(pd_brand,pr_brand)=sg_brand where pd_inoutno='" + pi_inoutno.Text + "' and sg_brand is not null");
|
|
|
DataTable dt1 = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
FrontCombo.DataSource = dt1;
|
|
|
FrontCombo.DisplayMember = "sg_brand";
|
|
|
@@ -925,8 +945,7 @@ namespace UAS_LabelMachine
|
|
|
DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
if (dr1.Length > 0)
|
|
|
{
|
|
|
- if (j != SingleDoc.Variables.FreeVariables.Count - 1)
|
|
|
- sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
+ sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
}
|
|
|
}
|
|
|
DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_id=" + pib_id, "select");
|
|
|
@@ -1070,9 +1089,10 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (!MidIDAndOutboxcode.ContainsValue(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()))
|
|
|
MidIDAndOutboxcode.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString(), LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString());
|
|
|
- if (!MidOutBoxCode.Contains(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())))
|
|
|
+ string outboxcode1 = LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString();
|
|
|
+ if (!MidOutBoxCode.Contains(int.Parse(outboxcode1 == "" ? "0" : outboxcode1)))
|
|
|
{
|
|
|
- MidOutBoxCode.Add(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()));
|
|
|
+ MidOutBoxCode.Add(int.Parse(outboxcode1 == "" ? "0" : outboxcode1));
|
|
|
MidOutBoxCodeIndex.Add(i);
|
|
|
}
|
|
|
}
|
|
|
@@ -1192,6 +1212,7 @@ namespace UAS_LabelMachine
|
|
|
//获取对应行的pib_id
|
|
|
string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
|
|
|
+ sql.Clear();
|
|
|
//设置最少打印盘数
|
|
|
if (OnlyPrint.Checked)
|
|
|
{
|
|
|
@@ -1205,11 +1226,10 @@ namespace UAS_LabelMachine
|
|
|
DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
if (dr1.Length > 0)
|
|
|
{
|
|
|
- if (j != MidDoc.Variables.FreeVariables.Count - 1)
|
|
|
- sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
+ sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
}
|
|
|
}
|
|
|
- DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1='" + pib_outboxcode1 + "'", "select");
|
|
|
+ DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + "select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + (pib_outboxcode1 == "" ? "0" : pib_outboxcode1), "select");
|
|
|
for (int j = 0; j < MidDoc.Variables.FreeVariables.Count; j++)
|
|
|
{
|
|
|
DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
@@ -1236,32 +1256,35 @@ namespace UAS_LabelMachine
|
|
|
//获取对应行的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.Clear();
|
|
|
for (int j = 0; j < OutBoxDoc.Variables.FreeVariables.Count; j++)
|
|
|
{
|
|
|
DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
if (dr1.Length > 0)
|
|
|
{
|
|
|
- if (j != OutBoxDoc.Variables.FreeVariables.Count - 1)
|
|
|
- sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
+ sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
}
|
|
|
}
|
|
|
- DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + pib_outboxcode2 + "'", "select");
|
|
|
- for (int j = 0; j < OutBoxDoc.Variables.FreeVariables.Count; j++)
|
|
|
+ DataTable dt = (DataTable)adh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2=" + (pib_outboxcode2 == "" ? "0" : pib_outboxcode2), "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
- {
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
- }
|
|
|
- if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
|
+ for (int j = 0; j < OutBoxDoc.Variables.FreeVariables.Count; j++)
|
|
|
{
|
|
|
- dr1 = Attach.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
+ DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
if (dr1.Length > 0)
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
+ {
|
|
|
+ OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
+ }
|
|
|
+ if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
|
+ {
|
|
|
+ dr1 = Attach.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower() + "'");
|
|
|
+ if (dr1.Length > 0)
|
|
|
+ OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
+ }
|
|
|
}
|
|
|
+ OutBoxDoc.Printer.SwitchTo(OutBoxPrinter.Text);
|
|
|
+ OutBoxDoc.PrintDocument();
|
|
|
}
|
|
|
- OutBoxDoc.Printer.SwitchTo(OutBoxPrinter.Text);
|
|
|
- OutBoxDoc.PrintDocument();
|
|
|
}
|
|
|
|
|
|
private void OutBoxLabelPrint_Click(object sender, EventArgs e)
|
|
|
@@ -1335,10 +1358,11 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
//嵌套查询重置RowNum
|
|
|
sql.Clear();
|
|
|
- sql.Append("select t.*,rownum from (select pib_custoutboxcode,pib_custmidboxcode,pr_orispeccode,pd_id,pd_custprodcode,pib_indate,pi_date,pib_inoutno,pd_custprodspec,nvl(pib_ifrecheck,0)pib_ifrecheck,nvl(pib_ifupload,0)pib_ifupload,nvl(pib_ifmodify,0)pib_ifmodify,pd_pocode,pib_madein,pib_custbarcode,");
|
|
|
- sql.Append("pib_id,pib_pdid,pib_piid,pib_pdno,pib_prodcode,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand, pr_vendprodcode,pib_lotno,pib_datecode,pib_qty,pr_spec,pi_title,pr_zxbzs,pr_unit,pib_barcode,pib_outboxcode1,");
|
|
|
- sql.Append("pib_outboxcode2,nvl(pib_ifpick,0)pib_ifpick,nvl(pib_ifprint,0)pib_ifprint from prodiobarcode left join prodinout on pib_piid=pi_id left join prodiodetail on pib_piid=pd_piid and pd_pdno=pib_pdno and ");
|
|
|
- sql.Append("pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join sale on sa_code=pib_ordercode where pib_piid='" + PI_ID + "' order by to_number(pib_id))t");
|
|
|
+ sql.Append("select t.*,rownum from (select pr_detail,,pib_custoutboxcode,pib_custmidboxcode,pr_orispeccode,pd_id,pd_custprodcode,pib_indate,pi_date,pib_inoutno,pd_custprodspec,");
|
|
|
+ sql.Append("nvl(pib_ifrecheck,0)pib_ifrecheck,pib_custprodspec,nvl(pib_ifupload,0)pib_ifupload,nvl(pib_ifmodify,0)pib_ifmodify,pd_pocode,pib_madein,pib_custbarcode,pib_id,pib_pdid,pib_piid,");
|
|
|
+ sql.Append("pib_pdno,pib_prodcode,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand, pr_vendprodcode,pib_lotno,pib_datecode,pib_qty,pr_spec,pi_title,pr_zxbzs,pr_unit,pib_barcode,pib_outboxcode1,");
|
|
|
+ sql.Append("pib_outboxcode2,nvl(pib_ifpick,0)pib_ifpick,nvl(pib_ifprint,0)pib_ifprint from prodiobarcode left join prodinout on pib_piid=pi_id left join prodiodetail on pib_piid=pd_piid and ");
|
|
|
+ sql.Append("pd_pdno=pib_pdno and pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join sale on sa_code=pib_ordercode where pib_piid='" + PI_ID + "' order by to_number(pib_id))t");
|
|
|
LabelInfDataTable = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
//检验查询的字段和本地数据库字段是否匹配
|
|
|
adh.AddColumFromDataTable(LabelInfDataTable, "prodiobarcode");
|
|
|
@@ -1374,8 +1398,8 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
UploadNum = 100;
|
|
|
}
|
|
|
- front_sg_separator.Text = dt.Rows[0]["splitback"].ToString();
|
|
|
- back_sg_separator.Text = dt.Rows[0]["splitfront"].ToString();
|
|
|
+ front_sg_separator.Text = dt.Rows[0]["splitfront"].ToString();
|
|
|
+ back_sg_separator.Text = dt.Rows[0]["splitback"].ToString();
|
|
|
}
|
|
|
//获取所有的匹配脚本
|
|
|
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");
|