usingbarcodetohtmlsystem.collections;
using
system.text.regularexpressions;
namespace
dotnet.utilities
} catch
string result_html = ""; //
html**
string color = ""; //
顏色
foreach (char c in
result_bin)
result_html += "
";
int len = ht['*'
].tostring().length;
foreach (char c in
s)
result_html += "
";
return
"" + (width * 10) + "
px;font-family:'楷體';\">
" + result_html + "
";
} public
static
string getean13(string s, int width, int
height)
$"))
$"))
else
} int sum_even = 0;//
偶數字之和
int sum_odd = 0; //
奇數字之和
for (int i = 0; i < 12; i++)
else
} int checkcode = (10 - (sum_even * 3 + sum_odd) % 10) % 10;//
校驗碼
if (checkcode_input > 0 && checkcode_input !=checkcode)
s += checkcode;//
變成13位
//000000000101左側42個01010右側35個校驗7個101000000000
//6 101左側6位 01010右側5位校驗1位101000000000
string result_bin = "";//
二進位制串
result_bin += "
000000000101
";
string type = ean13type(s[0
]);
for (int i = 1; i < 7; i++)
result_bin += "
01010
";
for (int i = 7; i < 13; i++)
result_bin += "
101000000000
";
string result_html = ""; //
html**
string color = ""; //
顏色
int height_bottom = width * 5
;
foreach (char c in
result_bin)
result_html += "
";
result_html += "
" + (width * 9) + "
px;text-align:center;\">
" + s[0] + "
";
result_html += "
" + width + "
px;height:
" + height_bottom + "
px;background:#000000;\">
";
result_html += "
" + width + "
px;height:
" + height_bottom + "
px;background:#ffffff;\">
";
result_html += "
" + width + "
px;height:
" + height_bottom + "
px;background:#000000;\">
";
for (int i = 1; i < 7; i++)
result_html += "
" + width + "
px;height:
" + height_bottom + "
px;background:#ffffff;\">
";
result_html += "
" + width + "
px;height:
" + height_bottom + "
px;background:#000000;\">
";
result_html += "
" + width + "
px;height:
" + height_bottom + "
px;background:#ffffff;\">
";
result_html += "
" + width + "
px;height:
" + height_bottom + "
px;background:#000000;\">
";
result_html += "
" + width + "
px;height:
" + height_bottom + "
px;background:#ffffff;\">
";
for (int i = 7; i < 13; i++)
result_html += "
" + width + "
px;height:
" + height_bottom + "
px;background:#000000;\">
";
result_html += "
" + width + "
px;height:
" + height_bottom + "
px;background:#ffffff;\">
";
result_html += "
" + width + "
px;height:
" + height_bottom + "
px;background:#000000;\">
";
result_html += "
" + (width * 9) + "
px;\">
";
result_html += "
";
return
"" + (width * 10) + "
px;font-family:'楷體';\">
" + result_html + "
";
} private
static
string ean13(char c, char
type)
} case'b
':
} case'c
':
} default: return
"error!
";
} }
private
static
string ean13type(char
c)
} }
}
條碼生成例項
1.下面是 string code39 生成條碼 bitmap,自定義條碼高度,自定義文字對齊樣式 public bitmap getcode39 string sourcecode,int barcodeheight,stringformat sf,string titlename 編碼 stre...
批量生成條碼教程
很多時候,在零售行業中,很多線下門店,倉庫管理就會用到掃碼功能。1 倉管員對購買的貨物,進行掃碼入口。2 倉管員對銷售的貨物進行,掃碼出庫。3 管理員對倉管員定時庫存盤點。那麼,乙個優秀的庫存系統,一定是有掃碼功能的,這樣倉管員在貨物管理的時候,就十分方便了,通過掃碼,查詢當前貨物詳情,庫存。使用情...
商品條碼的生成
最近客戶要求在貨品資料中生成商品條碼 即ean13,國際商品條碼 雖然系統中有商品條碼生成的工具,但是對不上號,根本無法使用,客戶的貨品資料已經有部分有條碼,更重要的是客戶要求生成商品條碼的貨品無法正常篩選出來 比如 gw開頭,或者是gm開頭,而且要求的是gw和gm後面全是數字的貨品才要求生成 客戶...