|
|
@@ -249,11 +249,11 @@ namespace UAS_MES_NEW.Make
|
|
|
//else//判断产品防呆
|
|
|
//{
|
|
|
//判断用户是否锁定输入转换后序列号长度,
|
|
|
- if (!checkLengthOrPre(afterTransSNLength_checkBox, afterTransSNLength, "长度"))
|
|
|
- return;
|
|
|
- //判断用户是否锁定输入转换后序列号前缀,
|
|
|
- if (!checkLengthOrPre(afterTransSNPre_checkBox, afterTransSNPre, "前缀"))
|
|
|
- return;
|
|
|
+ //if (!checkLengthOrPre(afterTransSNLength_checkBox, afterTransSNLength, "长度"))
|
|
|
+ // return;
|
|
|
+ ////判断用户是否锁定输入转换后序列号前缀,
|
|
|
+ //if (!checkLengthOrPre(afterTransSNPre_checkBox, afterTransSNPre, "前缀"))
|
|
|
+ // return;
|
|
|
//如果 ma_endremark1 不为空,校验 NoRule 中是否存在对应客户代码的条码规则
|
|
|
|
|
|
//}
|
|
|
@@ -311,7 +311,7 @@ namespace UAS_MES_NEW.Make
|
|
|
string updateSql = "";
|
|
|
//查询NoRule规则表,循环匹配转号后的条码规则,命中第一条则取客户代码
|
|
|
string custCode = "";
|
|
|
- DataTable nrDt = (DataTable)dh.ExecuteSql("select nrd_prefix,nrd_length,nrd_custcode from NoRule left join NORULEDETAIL on nr_id=nrd_nrid where nr_prodcode='" + ma_prodcode.Text + "'", "select");
|
|
|
+ DataTable nrDt = (DataTable)dh.ExecuteSql("select nrd_prefix,nrd_length,nrd_custcode,nrd_starttime,nrd_qty from NoRule left join NORULEDETAIL on nr_id=nrd_nrid where nr_prodcode='" + ma_prodcode.Text + "' and nvl(nrd_prefix,' ')<>' '", "select");
|
|
|
if (nrDt != null && nrDt.Rows.Count > 0)
|
|
|
{
|
|
|
for (int i = 0; i < nrDt.Rows.Count; i++)
|
|
|
@@ -334,24 +334,31 @@ namespace UAS_MES_NEW.Make
|
|
|
{
|
|
|
ma_endremark.Text = custCode;
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- OperateResult.AppendText("<<条码规则未匹配对应客户代码,必须输入客户代码\n", Color.Red, sncode);
|
|
|
- return;
|
|
|
- }
|
|
|
}
|
|
|
if (custCode == "")
|
|
|
{
|
|
|
- if (ma_endremark1.Text == "")
|
|
|
+ nrDt = (DataTable)dh.ExecuteSql("select nrd_length,nrd_custcode,nrd_starttime,nrd_qty from NoRule left join NORULEDETAIL on nr_id=nrd_nrid where nr_prodcode='" + ma_prodcode.Text + "' and nvl(nrd_prefix,' ')=' '", "select");
|
|
|
+ if (nrDt != null && nrDt.Rows.Count > 0)
|
|
|
{
|
|
|
- OperateResult.AppendText("<<条码规则未匹配对应客户代码,必须输入客户代码\n", Color.Red, sncode);
|
|
|
- return;
|
|
|
- }
|
|
|
- if (ma_endremark1.Text != "")
|
|
|
- {
|
|
|
- if (!dh.CheckExist("NoRule left join NORULEDETAIL on nr_id=nrd_nrid", "nr_prodcode='" + ma_prodcode.Text + "' and nrd_custcode='" + ma_endremark1.Text + "'"))
|
|
|
+ for (int i = 0; i < nrDt.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ string nrdLengthStr = nrDt.Rows[i]["nrd_length"].ToString();
|
|
|
+ int nrdLength = 0;
|
|
|
+ int.TryParse(nrdLengthStr, out nrdLength);
|
|
|
+ //判断转号后的条码是否符合规则:前缀匹配且长度匹配
|
|
|
+ bool lengthMatch = nrdLength <= 0 || sncode.Text.Length == nrdLength;
|
|
|
+ if (lengthMatch)
|
|
|
+ {
|
|
|
+ if (nrDt.Rows[i]["nrd_custcode"].ToString() == ma_custcode.Text) {
|
|
|
+ custCode = nrDt.Rows[i]["nrd_custcode"].ToString();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //匹配到客户代码则赋值到 ma_endremark
|
|
|
+ if (custCode == "")
|
|
|
{
|
|
|
- OperateResult.AppendText("<<未查询到产品编号" + ma_prodcode.Text + "对应客户代码" + ma_endremark1.Text + "的条码规则,不允许转号\n", Color.Red, sncode);
|
|
|
+ OperateResult.AppendText("<<条码规则未匹配对应客户代码,必须输入客户代码\n", Color.Red, sncode);
|
|
|
return;
|
|
|
}
|
|
|
}
|