|
|
@@ -14,15 +14,10 @@ namespace UAS_PRINT
|
|
|
class PrintHandler
|
|
|
{
|
|
|
|
|
|
- //图片打印中间变量
|
|
|
- static int imagecount = 0;
|
|
|
- static int index = 0;
|
|
|
-
|
|
|
//打印图片集合
|
|
|
static List<Bitmap> bitmaps = new List<Bitmap>();
|
|
|
-
|
|
|
- static DataTable dt = new DataTable("VENDORBARCODE_VIEW");
|
|
|
-
|
|
|
+ static DataTable dt = new DataTable();
|
|
|
+
|
|
|
public static void zplprint(string str, string PrinterName)
|
|
|
{
|
|
|
Dictionary<string, object> data = PrintHelper.ToDictionary(str);
|
|
|
@@ -79,6 +74,9 @@ namespace UAS_PRINT
|
|
|
{
|
|
|
Report Report = new Report();
|
|
|
string chooseprintername;
|
|
|
+ string label_type = "";
|
|
|
+ string label_name = "";
|
|
|
+
|
|
|
Dictionary<string, object> data = PrintHelper.ToDictionary(str);
|
|
|
List<Dictionary<string, object>> parameter = new List<Dictionary<string, object>>();
|
|
|
List<Dictionary<string, object>> barcode = new List<Dictionary<string, object>>();
|
|
|
@@ -98,11 +96,30 @@ namespace UAS_PRINT
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
- chooseprintername = "no";
|
|
|
+ MessageBox.Show("未传输打印机名称至打印程序,请联系管理员进行处理", "提示");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try
|
|
|
+ {
|
|
|
+ label_type = ((string)data["label_type"]).Replace("\"", "");
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ MessageBox.Show("未获取到标签类型,请联系管理员进行处理", "提示");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try
|
|
|
+ {
|
|
|
+ label_name = ((string)data["label_name"]).Replace("\"", "");
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ MessageBox.Show("未获取到标签名称,请联系管理员进行处理", "提示");
|
|
|
+ return;
|
|
|
}
|
|
|
try
|
|
|
{
|
|
|
- Report.Load(System.AppDomain.CurrentDomain.BaseDirectory + "库存条码打印.frx");
|
|
|
+ Report.Load(System.AppDomain.CurrentDomain.BaseDirectory + label_name+".frx");
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
@@ -155,8 +172,7 @@ namespace UAS_PRINT
|
|
|
if (!dt.Columns.Contains(itemc.Key))
|
|
|
dt.Columns.Add(DC);
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
}
|
|
|
foreach (var item in barcode)
|
|
|
{
|
|
|
@@ -203,9 +219,8 @@ namespace UAS_PRINT
|
|
|
}
|
|
|
try
|
|
|
{
|
|
|
-
|
|
|
- Report.RegisterData(dt, "BARCODE_PRINT_VIEW");
|
|
|
- Report.GetDataSource("BARCODE_PRINT_VIEW").Enabled = true;
|
|
|
+ Report.RegisterData(dt, label_type);
|
|
|
+ Report.GetDataSource(label_type).Enabled = true;
|
|
|
Report.PrintSettings.ShowDialog = false;
|
|
|
Report.PrintSettings.Printer = chooseprintername;
|
|
|
Report.Print();
|