|
@@ -88,6 +88,7 @@ namespace UAS_LabelMachine
|
|
|
//当前的物料品牌
|
|
|
string CurrentBrand = "";
|
|
|
|
|
|
+ string NrCode = "";
|
|
|
string Prefix = "";
|
|
|
string Suffix = "";
|
|
|
int MaxNum = 0;
|
|
@@ -404,7 +405,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
- dh.UpdateByCondition("RULEMAXNUM", "rmn_maxnumber='" + (MaxNum + 1) + "'", "rmn_nrcode='" + (pi_cardcode.Text == "" ? "Default" : pi_cardcode.Text) + "' and rmn_prefix='" + Prefix + "'");
|
|
|
+ dh.UpdateByCondition("RULEMAXNUM", "rmn_maxnumber='" + (MaxNum + 1) + "'", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and rmn_prefix='" + Prefix + "' and rmn_type='" + ReSetType + "'");
|
|
|
CollectInputData();
|
|
|
return;
|
|
|
}
|
|
@@ -601,7 +602,7 @@ namespace UAS_LabelMachine
|
|
|
LoadCheck = true;
|
|
|
Input.Clear();
|
|
|
sql.Clear();
|
|
|
- sql.Append("select pi_id,pi_cardcode,pi_combine_user,pi_title,to_char(pi_date,'yyyymmdd')pi_date,nvl(pi_combine_user,0)pi_combine_user from prodinout where pi_inoutno='" + pi_inoutno.Text + "' /*and pi_invostatuscode='AUDITED'*/");
|
|
|
+ sql.Append("select pi_id,pi_cardcode,pi_combine_user,pi_title,to_char(pi_date,'yyyymmdd')pi_date,nvl(pi_combine_user,0)pi_combine_user from prodinout where pi_inoutno='" + pi_inoutno.Text + "' and pi_invostatuscode='AUDITED'");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
@@ -1261,7 +1262,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
sql.Append(" order by to_number(pib_outboxcode2),pib_id,pd_prodcode");
|
|
|
LabelInfDataTable = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
- BoxCount.Text = LabelInfDataTable.Compute("sum(pib_qty)", "1=1").ToString()+"KPCS";
|
|
|
+ BoxCount.Text = LabelInfDataTable.Compute("sum(pib_qty)", "1=1").ToString() + "KPCS";
|
|
|
bindingsource(LabelInf, LabelInfDataTable);
|
|
|
if (LabelInf.Rows.Count > 0)
|
|
|
{
|
|
@@ -1582,6 +1583,7 @@ namespace UAS_LabelMachine
|
|
|
OutBoxNum.Text = OutBox;
|
|
|
}
|
|
|
|
|
|
+ string ReSetType = "";
|
|
|
/// <summary>
|
|
|
/// 获取条码规则
|
|
|
/// </summary>
|
|
@@ -1596,22 +1598,70 @@ namespace UAS_LabelMachine
|
|
|
//获取编码规则
|
|
|
Prefix = "";
|
|
|
Suffix = "";
|
|
|
+ NrCode = "";
|
|
|
MaxNum = 0;
|
|
|
SerialNumLength = 0;
|
|
|
Radix = 0;
|
|
|
- DataTable Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_type,nrd_radix,nrd_sql,nrd_length from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode='" + pi_cardcode.Text + "' order by nrd_detno", "select");
|
|
|
+ DataTable Nr = (DataTable)dh.ExecuteSql("select nvl(nr_resettype,' ')nr_resettype,nr_sharerule,nr_code,nrd_detno,nrd_name,nrd_type,nrd_radix,nrd_sql,nrd_length from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode='" + pi_cardcode.Text + "' order by nrd_detno", "select");
|
|
|
//如果没有则取公共规则
|
|
|
if (Nr.Rows.Count == 0)
|
|
|
- Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_radix,nrd_type,nrd_sql,nrd_length from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode is null and nr_isdefault <> 0 order by nrd_detno", "select");
|
|
|
+ Nr = (DataTable)dh.ExecuteSql("select nvl(nr_resettype,' ')nr_resettype,nr_sharerule,nr_code,nrd_detno,nrd_name,nrd_radix,nrd_type,nrd_sql,nrd_length from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode is null and nr_isdefault <> 0 order by nrd_detno", "select");
|
|
|
//用于过滤参数的正则表达式
|
|
|
+ ReSetType = "";
|
|
|
+ if (Nr.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ string ShareRule = Nr.Rows[0]["nr_sharerule"].ToString();
|
|
|
+ DataTable dt1 = (DataTable)dh.ExecuteSql("select nvl(nr_resettype,' ')nr_resettype,nr_sharerule,nr_code,nrd_detno,nrd_name,nrd_radix,nrd_type,nrd_sql,nrd_length from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_code='" + ShareRule + "' order by nrd_detno", "select");
|
|
|
+ if (dt1.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ Nr = dt1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (ShareRule != "")
|
|
|
+ {
|
|
|
+ MessageBox.Show("共享规则" + ShareRule + "不存在");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (Nr.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ switch (Nr.Rows[0]["nr_resettype"].ToString())
|
|
|
+ {
|
|
|
+ case "Year":
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("to_char(sysdate,'yyyy')");
|
|
|
+ break;
|
|
|
+ case "Month":
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("to_char(sysdate,'yyyyMM')");
|
|
|
+ break;
|
|
|
+ case "Week":
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("to_char(sysdate,'yyyyiw')");
|
|
|
+ break;
|
|
|
+ case "Day":
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("to_char(sysdate,'yyyyMMdd')");
|
|
|
+ break;
|
|
|
+ case " ":
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("' '");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ ReSetType = dh.getFieldDataByCondition("dual", sql.ToString(), "1=1").ToString();
|
|
|
+ }
|
|
|
Regex match = new Regex("{\\w+}");
|
|
|
//用于存放每一项的明细的数据
|
|
|
string[] NrData = new string[Nr.Rows.Count];
|
|
|
//流水长度
|
|
|
Dictionary<int, string> NrDic = new Dictionary<int, string>();
|
|
|
- Prefix = "";
|
|
|
for (int m = 0; m < Nr.Rows.Count; m++)
|
|
|
{
|
|
|
+ NrCode = Nr.Rows[m]["nr_code"].ToString();
|
|
|
switch (Nr.Rows[m]["nrd_type"].ToString())
|
|
|
{
|
|
|
//常量直接进行拼接
|
|
@@ -1645,17 +1695,26 @@ namespace UAS_LabelMachine
|
|
|
break;
|
|
|
//流水需要通过MaxNumber去取
|
|
|
case "流水":
|
|
|
- string maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (pi_cardcode.Text == "" ? "Default" : pi_cardcode.Text) + "' and rmn_prefix='" + Prefix + "'").ToString();
|
|
|
+ string maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and rmn_prefix='" + Prefix + "' and nvl(rmn_type,' ')='" + ReSetType + "'").ToString();
|
|
|
//设置当前流水
|
|
|
if (maxnum == "")
|
|
|
{
|
|
|
- dh.ExecuteSql("insert into RuleMaxNum(rmn_id,rmn_nrcode,rmn_prefix,rmn_maxnumber) values(RuleMaxNum_seq.nextval,'" + (pi_cardcode.Text == "" ? "Default" : pi_cardcode.Text) + "','" + Prefix + "','" + Count + "')", "insert");
|
|
|
- MaxNum = 1;
|
|
|
+ maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and nvl(rmn_type,' ')='" + ReSetType + "'").ToString();
|
|
|
+ if (maxnum != "")
|
|
|
+ {
|
|
|
+ Count = int.Parse(maxnum) + Count;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ maxnum = "1";
|
|
|
+ }
|
|
|
+ dh.ExecuteSql("insert into RuleMaxNum(rmn_id,rmn_nrcode,rmn_prefix,rmn_maxnumber,rmn_type) values(RuleMaxNum_seq.nextval,'" + (NrCode == "" ? "Default" : NrCode) + "','" + Prefix + "','" + Count + "','" + ReSetType + "')", "insert");
|
|
|
+ MaxNum = int.Parse(maxnum);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
MaxNum = int.Parse(maxnum);
|
|
|
- dh.UpdateByCondition("RULEMAXNUM", "rmn_maxnumber='" + (MaxNum + Count) + "'", "rmn_nrcode='" + (pi_cardcode.Text == "" ? "Default" : pi_cardcode.Text) + "' and rmn_prefix='" + Prefix + "'");
|
|
|
+ dh.UpdateByCondition("RULEMAXNUM", "rmn_maxnumber='" + (MaxNum + Count) + "'", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and rmn_prefix='" + Prefix + "' and rmn_type='" + ReSetType + "'");
|
|
|
}
|
|
|
SerialNumLength = int.Parse(Nr.Rows[m]["nrd_length"].ToString());
|
|
|
Radix = int.Parse(Nr.Rows[m]["nrd_radix"].ToString());
|
|
@@ -1838,12 +1897,14 @@ namespace UAS_LabelMachine
|
|
|
string FWhcode = LabelInf.Rows[i].Cells["pib_brand"].Value.ToString();
|
|
|
string FDC = LabelInf.Rows[i].Cells["pib_datecode"].Value.ToString();
|
|
|
string FLOTNO = LabelInf.Rows[i].Cells["pib_lotno"].Value.ToString();
|
|
|
+ string FPDCustProdCode = LabelInf.Rows[i].Cells["pd_custprodcode"].Value.ToString();
|
|
|
string BPrcode = LabelInf.Rows[i + 1].Cells["pib_prodcode"].Value.ToString();
|
|
|
string BPocode = LabelInf.Rows[i + 1].Cells["pd_pocode"].Value.ToString();
|
|
|
string BWhcode = LabelInf.Rows[i + 1].Cells["pib_brand"].Value.ToString();
|
|
|
string BDC = LabelInf.Rows[i + 1].Cells["pib_datecode"].Value.ToString();
|
|
|
string BLOTNO = LabelInf.Rows[i + 1].Cells["pib_lotno"].Value.ToString();
|
|
|
- if (FPrcode != BPrcode || FPocode != BPocode || FWhcode != BWhcode || (DiffDC.Checked && FDC != BDC) || (DiffLotNo.Checked && FLOTNO != BLOTNO))
|
|
|
+ string BPDCustProdCode = LabelInf.Rows[i + 1].Cells["pd_custprodcode"].Value.ToString();
|
|
|
+ if (FPDCustProdCode != BPDCustProdCode || FPrcode != BPrcode || FPocode != BPocode || FWhcode != BWhcode || (DiffDC.Checked && FDC != BDC) || (DiffLotNo.Checked && FLOTNO != BLOTNO))
|
|
|
{
|
|
|
GetNumCount = GetNumCount + 1;
|
|
|
}
|