|
|
@@ -87,10 +87,10 @@ namespace UAS_LabelMachine
|
|
|
private void GenerateBarCode_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
//获取编码规则
|
|
|
- DataTable Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_type,nrd_sql,nrd_length from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode='" + CustCode + "' order by nrd_detno", "select");
|
|
|
+ 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='" + CustCode + "' order by nrd_detno", "select");
|
|
|
//如果没有则取公共规则
|
|
|
if (Nr.Rows.Count == 0)
|
|
|
- Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,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 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");
|
|
|
//用于过滤参数的正则表达式
|
|
|
Regex match = new Regex("{\\w+}");
|
|
|
//用于存放每一项的明细的数据
|
|
|
@@ -100,6 +100,7 @@ namespace UAS_LabelMachine
|
|
|
//流水长度
|
|
|
int SerialNumLength = 0;
|
|
|
//存放键值对
|
|
|
+ int Radix = 10;
|
|
|
Dictionary<int, string> NrDic = new Dictionary<int, string>();
|
|
|
for (int m = 0; m < Nr.Rows.Count; m++)
|
|
|
{
|
|
|
@@ -146,6 +147,7 @@ namespace UAS_LabelMachine
|
|
|
custserialnum = int.Parse(NrData[m] == "" ? "0" : NrData[m]);
|
|
|
SerialNumIndex = m;
|
|
|
SerialNumLength = int.Parse(Nr.Rows[m]["nrd_length"].ToString());
|
|
|
+ Radix = int.Parse(Nr.Rows[m]["nrd_radix"].ToString());
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
@@ -240,7 +242,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
//将箱号添加进List
|
|
|
barcode.Add(BarcodeMethod1(pd_id, pr_id, pib_barcode));
|
|
|
- custbarcode.Add(BarcodeMethod1(NrDic, SerialNumIndex, SerialNumLength));
|
|
|
+ custbarcode.Add(BarcodeMethod1(NrDic, SerialNumIndex, SerialNumLength, Radix));
|
|
|
midcode.Add(mid_code);
|
|
|
if (mid_remain % pr_zxbzs != 0 && k + 1 == count && j + 1 == mid_num)
|
|
|
AddNum = mid_remain % pr_zxbzs;
|
|
|
@@ -306,7 +308,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
|
|
|
//生成客户条码
|
|
|
- public string BarcodeMethod1(Dictionary<int, string> Dic, int Index, int Length)
|
|
|
+ public string BarcodeMethod1(Dictionary<int, string> Dic, int Index, int Length, int radix)
|
|
|
{
|
|
|
string str = "";
|
|
|
for (int i = 0; i < Dic.Count; i++)
|
|
|
@@ -319,7 +321,7 @@ namespace UAS_LabelMachine
|
|
|
else
|
|
|
{
|
|
|
//如果是流水则需要在前面加0
|
|
|
- string serialcode = custserialnum.ToString();
|
|
|
+ string serialcode = BaseUtil.DToAny(custserialnum, radix);
|
|
|
for (int j = serialcode.ToString().Length; j < Length; j++)
|
|
|
{
|
|
|
serialcode = "0" + serialcode;
|