|
@@ -13,6 +13,7 @@ using System.Threading;
|
|
|
using System.Net;
|
|
using System.Net;
|
|
|
using System.Text;
|
|
using System.Text;
|
|
|
using System.Web;
|
|
using System.Web;
|
|
|
|
|
+using System.Diagnostics;
|
|
|
|
|
|
|
|
namespace UAS_Web.tool
|
|
namespace UAS_Web.tool
|
|
|
{
|
|
{
|
|
@@ -25,7 +26,8 @@ namespace UAS_Web.tool
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- Report Report = new Report();
|
|
|
|
|
|
|
+ Report BarcodeReport = new Report();
|
|
|
|
|
+ Report BoxReport = new Report();
|
|
|
|
|
|
|
|
//图片打印中间变量
|
|
//图片打印中间变量
|
|
|
int imagecount = 0;
|
|
int imagecount = 0;
|
|
@@ -153,217 +155,248 @@ namespace UAS_Web.tool
|
|
|
PrintType = data["data"].ToString().Replace("\"", "");
|
|
PrintType = data["data"].ToString().Replace("\"", "");
|
|
|
break;
|
|
break;
|
|
|
case "vendorZplPrint.action":
|
|
case "vendorZplPrint.action":
|
|
|
- DataTable dt = new DataTable();
|
|
|
|
|
- RadioButton PRFR = (RadioButton)print.Controls["PRFR"];
|
|
|
|
|
- RadioButton PRPIC = (RadioButton)print.Controls["PRPIC"];
|
|
|
|
|
- string type;
|
|
|
|
|
- bitmaps.Clear();
|
|
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
filter = FilterManager.GetFileter(request.Identifier.ToString()) as MessageFilter;
|
|
filter = FilterManager.GetFileter(request.Identifier.ToString()) as MessageFilter;
|
|
|
str = System.Text.Encoding.UTF8.GetString(filter.dataAll.ToArray());
|
|
str = System.Text.Encoding.UTF8.GetString(filter.dataAll.ToArray());
|
|
|
data = ToDictionary(str);
|
|
data = ToDictionary(str);
|
|
|
|
|
+ vendorZplPrint(data);
|
|
|
}
|
|
}
|
|
|
- catch {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- List<Dictionary<string, object>> parameter = new List<Dictionary<string, object>>();
|
|
|
|
|
- List<Dictionary<string, object>> barcode = new List<Dictionary<string, object>>();
|
|
|
|
|
- parameter = (List<Dictionary<string, object>>)data["parameter"];
|
|
|
|
|
- barcode = (List<Dictionary<string, object>>)data["barcode"];
|
|
|
|
|
- try
|
|
|
|
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
{
|
|
|
- type = ((String)data["type"]).Replace("\"", "");
|
|
|
|
|
- }
|
|
|
|
|
- catch {
|
|
|
|
|
- type = "no";
|
|
|
|
|
|
|
+ MessageBox.Show(ex.Message + "请重新进行打印");
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if (PRFR.Checked)
|
|
|
|
|
|
|
+ public void vendorZplPrint(Object data)
|
|
|
|
|
+ {
|
|
|
|
|
+ DataTable dt = new DataTable();
|
|
|
|
|
+ RadioButton PRFR = (RadioButton)print.Controls["PRFR"];
|
|
|
|
|
+ RadioButton PRPIC = (RadioButton)print.Controls["PRPIC"];
|
|
|
|
|
+ string type;
|
|
|
|
|
+ bitmaps.Clear();
|
|
|
|
|
+ List<Dictionary<string, object>> parameter = new List<Dictionary<string, object>>();
|
|
|
|
|
+ List<Dictionary<string, object>> barcode = new List<Dictionary<string, object>>();
|
|
|
|
|
+ try
|
|
|
|
|
+ {
|
|
|
|
|
+ parameter = (List<Dictionary<string, object>>)((Dictionary<string, object>)data)["parameter"];
|
|
|
|
|
+ barcode = (List<Dictionary<string, object>>)((Dictionary<string, object>)data)["barcode"];
|
|
|
|
|
+ }
|
|
|
|
|
+ catch {
|
|
|
|
|
+ MessageBox.Show("打印数据解析异常,请联系管理员进行处理");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ try
|
|
|
|
|
+ {
|
|
|
|
|
+ type = ((String)((Dictionary<string, object>)data)["type"]).Replace("\"", "");
|
|
|
|
|
+ }
|
|
|
|
|
+ catch
|
|
|
|
|
+ {
|
|
|
|
|
+ type = "no";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (PRFR.Checked)
|
|
|
|
|
+ {
|
|
|
|
|
+ Thread.Sleep(1000);
|
|
|
|
|
+ int i = 0;
|
|
|
|
|
+ while (DownLoadFile.downloading && i < 2)
|
|
|
|
|
+ {
|
|
|
|
|
+ Thread.Sleep(1000);
|
|
|
|
|
+ i++;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (DownLoadFile.downloading)
|
|
|
|
|
+ Console.WriteLine("标签更新有误");
|
|
|
|
|
+ try
|
|
|
|
|
+ {
|
|
|
|
|
+ if (type == "box")
|
|
|
{
|
|
{
|
|
|
- Thread.Sleep(800);
|
|
|
|
|
- try
|
|
|
|
|
- {
|
|
|
|
|
- if (type == "box")
|
|
|
|
|
- {
|
|
|
|
|
- Report.Load(System.AppDomain.CurrentDomain.BaseDirectory + "GD_box.frx");
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- Report.Load(System.AppDomain.CurrentDomain.BaseDirectory + LABELNAME+".frx");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- catch
|
|
|
|
|
- {
|
|
|
|
|
- MessageBox.Show("未找到可使用的标签文件");
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ BoxReport.Load(System.AppDomain.CurrentDomain.BaseDirectory + LABELNAME + ".frx");
|
|
|
}
|
|
}
|
|
|
- int la_width = int.Parse(parameter.First()["LA_WIDTH"].ToString());
|
|
|
|
|
- int la_height = int.Parse(parameter.First()["LA_HEIGHT"].ToString());
|
|
|
|
|
|
|
+ else {
|
|
|
|
|
+ BarcodeReport.Load(System.AppDomain.CurrentDomain.BaseDirectory + LABELNAME + ".frx");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ catch
|
|
|
|
|
+ {
|
|
|
|
|
+ MessageBox.Show("未找到可使用的标签文件,请重试");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ int la_width = int.Parse(parameter.First()["LA_WIDTH"].ToString());
|
|
|
|
|
+ int la_height = int.Parse(parameter.First()["LA_HEIGHT"].ToString());
|
|
|
|
|
|
|
|
- foreach (var item in barcode)
|
|
|
|
|
- {
|
|
|
|
|
- Bitmap bit = new Bitmap(la_width * 10, la_height * 4);
|
|
|
|
|
|
|
+ foreach (var item in barcode)
|
|
|
|
|
+ {
|
|
|
|
|
+ Bitmap bit = new Bitmap(la_width * 10, la_height * 4);
|
|
|
|
|
|
|
|
|
|
|
|
|
- using (Graphics g = Graphics.FromImage(bit))
|
|
|
|
|
|
|
+ using (Graphics g = Graphics.FromImage(bit))
|
|
|
|
|
+ {
|
|
|
|
|
+ //g.CompositingQuality = CompositingQuality.HighQuality;
|
|
|
|
|
+ //g.SmoothingMode = SmoothingMode.HighQuality;
|
|
|
|
|
+ //g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
|
|
|
|
+ ////定义一枝画笔
|
|
|
|
|
+ //Pen pen = new Pen(Color.Black);
|
|
|
|
|
+ ////用这个画笔在左上角画一个矩形
|
|
|
|
|
+ //g.DrawRectangle(pen, new Rectangle(10, 10, 50, 20));
|
|
|
|
|
+ foreach (var itemc in item)
|
|
|
|
|
+ {
|
|
|
|
|
+ Dictionary<string, object> Sidc = parameter.Find(p => p["LP_NAME"].ToString().Replace(" ", "").Replace("\"", "").ToUpper() == itemc.Key.ToUpper());
|
|
|
|
|
+ if (Sidc != null)
|
|
|
{
|
|
{
|
|
|
- //g.CompositingQuality = CompositingQuality.HighQuality;
|
|
|
|
|
- //g.SmoothingMode = SmoothingMode.HighQuality;
|
|
|
|
|
- //g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
|
|
|
|
- ////定义一枝画笔
|
|
|
|
|
- //Pen pen = new Pen(Color.Black);
|
|
|
|
|
- ////用这个画笔在左上角画一个矩形
|
|
|
|
|
- //g.DrawRectangle(pen, new Rectangle(10, 10, 50, 20));
|
|
|
|
|
- foreach (var itemc in item)
|
|
|
|
|
|
|
+ if (Sidc["LP_VALUETYPE"].ToString().Replace(" ", "").Replace("\"", "") == "text")
|
|
|
{
|
|
{
|
|
|
- Dictionary<string, object> Sidc = parameter.Find(p => p["LP_NAME"].ToString().Replace(" ", "").Replace("\"", "").ToUpper() == itemc.Key.ToUpper());
|
|
|
|
|
- if (Sidc["LP_VALUETYPE"].ToString().Replace(" ", "").Replace("\"", "") == "text")
|
|
|
|
|
|
|
+ string itemstr = "";
|
|
|
|
|
+ if (itemc.Value != null)
|
|
|
{
|
|
{
|
|
|
- string itemstr = "";
|
|
|
|
|
- if (itemc.Value != null)
|
|
|
|
|
|
|
+ itemstr = itemc.Value.ToString();
|
|
|
|
|
+ while (itemstr.StartsWith("\f") || itemstr.StartsWith("\v") || itemstr.StartsWith("\t") || itemstr.StartsWith("\r") || itemstr.StartsWith("\n"))
|
|
|
{
|
|
{
|
|
|
- itemstr = itemc.Value.ToString();
|
|
|
|
|
- while (itemstr.StartsWith("\f") || itemstr.StartsWith("\v") || itemstr.StartsWith("\t") || itemstr.StartsWith("\r") || itemstr.StartsWith("\n"))
|
|
|
|
|
- {
|
|
|
|
|
- itemstr = itemstr.Remove(0, 2);
|
|
|
|
|
- }
|
|
|
|
|
- if (itemstr.StartsWith("\""))
|
|
|
|
|
- {
|
|
|
|
|
- itemstr = itemstr.Remove(0, 1);
|
|
|
|
|
- }
|
|
|
|
|
- while (itemstr.EndsWith("\f") || itemstr.EndsWith("\v") || itemstr.EndsWith("\t") || itemstr.EndsWith("\r") || itemstr.EndsWith("\n"))
|
|
|
|
|
- {
|
|
|
|
|
- itemstr = itemstr.Remove(itemstr.Length - 2);
|
|
|
|
|
- }
|
|
|
|
|
- if (itemstr.EndsWith("\""))
|
|
|
|
|
- {
|
|
|
|
|
- itemstr = itemstr.Remove(itemstr.Length - 1);
|
|
|
|
|
- }
|
|
|
|
|
- if (itemstr.Contains("\\\""))
|
|
|
|
|
- {
|
|
|
|
|
- itemstr = itemstr.Replace("\\\"", "\"");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ itemstr = itemstr.Remove(0, 2);
|
|
|
}
|
|
}
|
|
|
- if (PRFR.Checked)
|
|
|
|
|
|
|
+ if (itemstr.StartsWith("\""))
|
|
|
{
|
|
{
|
|
|
- DataColumn DC = new DataColumn(itemc.Key, Type.GetType("System.String"));
|
|
|
|
|
- if (!dt.Columns.Contains(itemc.Key))
|
|
|
|
|
- dt.Columns.Add(DC);
|
|
|
|
|
|
|
+ itemstr = itemstr.Remove(0, 1);
|
|
|
}
|
|
}
|
|
|
- if (PRPIC.Checked)
|
|
|
|
|
|
|
+ while (itemstr.EndsWith("\f") || itemstr.EndsWith("\v") || itemstr.EndsWith("\t") || itemstr.EndsWith("\r") || itemstr.EndsWith("\n"))
|
|
|
{
|
|
{
|
|
|
- PrintHelper.Printstring(itemc.Value != null ? itemstr : " ", int.Parse(Sidc["LP_SIZE"].ToString()), g, int.Parse(Sidc["LP_LEFTRATE"].ToString()), int.Parse(Sidc["LP_TOPRATE"].ToString()));
|
|
|
|
|
|
|
+ itemstr = itemstr.Remove(itemstr.Length - 2);
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- else if (Sidc["LP_VALUETYPE"].ToString().Replace(" ", "").Replace("\"", "") == "barcode")
|
|
|
|
|
- {
|
|
|
|
|
- if (PRFR.Checked)
|
|
|
|
|
|
|
+ if (itemstr.EndsWith("\""))
|
|
|
{
|
|
{
|
|
|
- DataColumn DC = new DataColumn(itemc.Key, Type.GetType("System.String"));
|
|
|
|
|
- if (!dt.Columns.Contains(itemc.Key))
|
|
|
|
|
- dt.Columns.Add(DC);
|
|
|
|
|
|
|
+ itemstr = itemstr.Remove(itemstr.Length - 1);
|
|
|
}
|
|
}
|
|
|
- if (PRPIC.Checked)
|
|
|
|
|
|
|
+ if (itemstr.Contains("\\\""))
|
|
|
{
|
|
{
|
|
|
- PrintHelper.DrawBarcode(itemc.Value != null ? itemc.Value.ToString().Replace("\"", "") : " ", ref bit, double.Parse(Sidc["LP_LEFTRATE"].ToString()), double.Parse(Sidc["LP_TOPRATE"].ToString()), double.Parse(Sidc["LP_WIDTH"].ToString()), double.Parse(Sidc["LP_HEIGHT"].ToString()) - 2);
|
|
|
|
|
- PrintHelper.Printstring(itemc.Value != null ? itemc.Value.ToString().Replace("\"", "") : " ", int.Parse(Sidc["LP_SIZE"].ToString()), g, int.Parse(Sidc["LP_LEFTRATE"].ToString()), int.Parse(Sidc["LP_TOPRATE"].ToString()) + double.Parse(Sidc["LP_HEIGHT"].ToString()) - 2);
|
|
|
|
|
|
|
+ itemstr = itemstr.Replace("\\\"", "\"");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ if (PRFR.Checked)
|
|
|
|
|
+ {
|
|
|
|
|
+ DataColumn DC = new DataColumn(itemc.Key, Type.GetType("System.String"));
|
|
|
|
|
+ if (!dt.Columns.Contains(itemc.Key))
|
|
|
|
|
+ dt.Columns.Add(DC);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (PRPIC.Checked)
|
|
|
|
|
+ {
|
|
|
|
|
+ PrintHelper.Printstring(itemc.Value != null ? itemstr : " ", int.Parse(Sidc["LP_SIZE"].ToString()), g, int.Parse(Sidc["LP_LEFTRATE"].ToString()), int.Parse(Sidc["LP_TOPRATE"].ToString()));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- bitmaps.Add(bit);
|
|
|
|
|
- }
|
|
|
|
|
- if (PRFR.Checked)
|
|
|
|
|
- {
|
|
|
|
|
- foreach (var item in barcode)
|
|
|
|
|
- {
|
|
|
|
|
- DataRow dr = dt.NewRow();
|
|
|
|
|
- //g.CompositingQuality = CompositingQuality.HighQuality;
|
|
|
|
|
- //g.SmoothingMode = SmoothingMode.HighQuality;
|
|
|
|
|
- //g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
|
|
|
|
- ////定义一枝画笔
|
|
|
|
|
- //Pen pen = new Pen(Color.Black);
|
|
|
|
|
- ////用这个画笔在左上角画一个矩形
|
|
|
|
|
- //g.DrawRectangle(pen, new Rectangle(10, 10, 50, 20));
|
|
|
|
|
- foreach (var itemc in item)
|
|
|
|
|
|
|
+ else if (Sidc["LP_VALUETYPE"].ToString().Replace(" ", "").Replace("\"", "") == "barcode")
|
|
|
{
|
|
{
|
|
|
- Dictionary<string, object> Sidc = parameter.Find(p => p["LP_NAME"].ToString().Replace(" ", "").Replace("\"", "").ToUpper() == itemc.Key.ToUpper());
|
|
|
|
|
- if (Sidc["LP_VALUETYPE"].ToString().Replace(" ", "").Replace("\"", "") == "text")
|
|
|
|
|
|
|
+ if (PRFR.Checked)
|
|
|
{
|
|
{
|
|
|
- string itemstr = "";
|
|
|
|
|
- if (itemc.Value != null)
|
|
|
|
|
- {
|
|
|
|
|
- itemstr = itemc.Value.ToString();
|
|
|
|
|
- while (itemstr.StartsWith("\f") || itemstr.StartsWith("\v") || itemstr.StartsWith("\t") || itemstr.StartsWith("\r") || itemstr.StartsWith("\n"))
|
|
|
|
|
- {
|
|
|
|
|
- itemstr = itemstr.Remove(0, 2);
|
|
|
|
|
- }
|
|
|
|
|
- if (itemstr.StartsWith("\""))
|
|
|
|
|
- {
|
|
|
|
|
- itemstr = itemstr.Remove(0, 1);
|
|
|
|
|
- }
|
|
|
|
|
- while (itemstr.EndsWith("\f") || itemstr.EndsWith("\v") || itemstr.EndsWith("\t") || itemstr.EndsWith("\r") || itemstr.EndsWith("\n"))
|
|
|
|
|
- {
|
|
|
|
|
- itemstr = itemstr.Remove(itemstr.Length - 2);
|
|
|
|
|
- }
|
|
|
|
|
- if (itemstr.EndsWith("\""))
|
|
|
|
|
- {
|
|
|
|
|
- itemstr = itemstr.Remove(itemstr.Length - 1);
|
|
|
|
|
- }
|
|
|
|
|
- if (itemstr.Contains("\\\""))
|
|
|
|
|
- {
|
|
|
|
|
- itemstr = itemstr.Replace("\\\"", "\"");
|
|
|
|
|
- Console.WriteLine(itemstr);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- dr[itemc.Key] = itemstr;
|
|
|
|
|
|
|
+ DataColumn DC = new DataColumn(itemc.Key, Type.GetType("System.String"));
|
|
|
|
|
+ if (!dt.Columns.Contains(itemc.Key))
|
|
|
|
|
+ dt.Columns.Add(DC);
|
|
|
}
|
|
}
|
|
|
- else if (Sidc["LP_VALUETYPE"].ToString().Replace(" ", "").Replace("\"", "") == "barcode")
|
|
|
|
|
|
|
+ if (PRPIC.Checked)
|
|
|
{
|
|
{
|
|
|
- dr[itemc.Key] = itemc.Value.ToString().Replace("\"", "");
|
|
|
|
|
|
|
+ PrintHelper.DrawBarcode(itemc.Value != null ? itemc.Value.ToString().Replace("\"", "") : " ", ref bit, double.Parse(Sidc["LP_LEFTRATE"].ToString()), double.Parse(Sidc["LP_TOPRATE"].ToString()), double.Parse(Sidc["LP_WIDTH"].ToString()), double.Parse(Sidc["LP_HEIGHT"].ToString()) - 2);
|
|
|
|
|
+ PrintHelper.Printstring(itemc.Value != null ? itemc.Value.ToString().Replace("\"", "") : " ", int.Parse(Sidc["LP_SIZE"].ToString()), g, int.Parse(Sidc["LP_LEFTRATE"].ToString()), int.Parse(Sidc["LP_TOPRATE"].ToString()) + double.Parse(Sidc["LP_HEIGHT"].ToString()) - 2);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- dt.Rows.Add(dr);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (PRPIC.Checked)
|
|
|
|
|
- {
|
|
|
|
|
- if (bitmaps.Count > 0)
|
|
|
|
|
- {
|
|
|
|
|
- imagecount = bitmaps.Count;
|
|
|
|
|
- ////设置打印机名称
|
|
|
|
|
-
|
|
|
|
|
- print.PrintDoc.Print();
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if(PRFR.Checked)
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ bitmaps.Add(bit);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (PRFR.Checked)
|
|
|
|
|
+ {
|
|
|
|
|
+ foreach (var item in barcode)
|
|
|
|
|
+ {
|
|
|
|
|
+ DataRow dr = dt.NewRow();
|
|
|
|
|
+ //g.CompositingQuality = CompositingQuality.HighQuality;
|
|
|
|
|
+ //g.SmoothingMode = SmoothingMode.HighQuality;
|
|
|
|
|
+ //g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
|
|
|
|
+ ////定义一枝画笔
|
|
|
|
|
+ //Pen pen = new Pen(Color.Black);
|
|
|
|
|
+ ////用这个画笔在左上角画一个矩形
|
|
|
|
|
+ //g.DrawRectangle(pen, new Rectangle(10, 10, 50, 20));
|
|
|
|
|
+ foreach (var itemc in item)
|
|
|
{
|
|
{
|
|
|
- try
|
|
|
|
|
|
|
+ Dictionary<string, object> Sidc = parameter.Find(p => p["LP_NAME"].ToString().Replace(" ", "").Replace("\"", "").ToUpper() == itemc.Key.ToUpper());
|
|
|
|
|
+ if (Sidc != null)
|
|
|
{
|
|
{
|
|
|
- if (type == "box")
|
|
|
|
|
|
|
+ if (Sidc["LP_VALUETYPE"].ToString().Replace(" ", "").Replace("\"", "") == "text")
|
|
|
{
|
|
{
|
|
|
- Report.RegisterData(dt, "VENDORBARCODE_BOX_VIEW");
|
|
|
|
|
- Report.GetDataSource("VENDORBARCODE_BOX_VIEW").Enabled = true;
|
|
|
|
|
|
|
+ string itemstr = "";
|
|
|
|
|
+ if (itemc.Value != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ itemstr = itemc.Value.ToString();
|
|
|
|
|
+ while (itemstr.StartsWith("\f") || itemstr.StartsWith("\v") || itemstr.StartsWith("\t") || itemstr.StartsWith("\r") || itemstr.StartsWith("\n"))
|
|
|
|
|
+ {
|
|
|
|
|
+ itemstr = itemstr.Remove(0, 2);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (itemstr.StartsWith("\""))
|
|
|
|
|
+ {
|
|
|
|
|
+ itemstr = itemstr.Remove(0, 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ while (itemstr.EndsWith("\f") || itemstr.EndsWith("\v") || itemstr.EndsWith("\t") || itemstr.EndsWith("\r") || itemstr.EndsWith("\n"))
|
|
|
|
|
+ {
|
|
|
|
|
+ itemstr = itemstr.Remove(itemstr.Length - 2);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (itemstr.EndsWith("\""))
|
|
|
|
|
+ {
|
|
|
|
|
+ itemstr = itemstr.Remove(itemstr.Length - 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (itemstr.Contains("\\\""))
|
|
|
|
|
+ {
|
|
|
|
|
+ itemstr = itemstr.Replace("\\\"", "\"");
|
|
|
|
|
+ Console.WriteLine(itemstr);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ dr[itemc.Key] = itemstr;
|
|
|
}
|
|
}
|
|
|
- else {
|
|
|
|
|
- Report.RegisterData(dt, "VENDORBARCODE_VIEW");
|
|
|
|
|
- Report.GetDataSource("VENDORBARCODE_VIEW").Enabled = true;
|
|
|
|
|
|
|
+ else if (Sidc["LP_VALUETYPE"].ToString().Replace(" ", "").Replace("\"", "") == "barcode")
|
|
|
|
|
+ {
|
|
|
|
|
+ dr[itemc.Key] = itemc.Value.ToString().Replace("\"", "");
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- Report.PrintSettings.ShowDialog = false;
|
|
|
|
|
- Report.PrintSettings.Printer = PrinterName;
|
|
|
|
|
- Report.Print();
|
|
|
|
|
- }
|
|
|
|
|
- catch {
|
|
|
|
|
- MessageBox.Show("程序打印出现错误,请检查标签文件格式");
|
|
|
|
|
}
|
|
}
|
|
|
- dt.Clear();
|
|
|
|
|
}
|
|
}
|
|
|
- break;
|
|
|
|
|
- default:
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+ dt.Rows.Add(dr);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (PRPIC.Checked)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (bitmaps.Count > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ imagecount = bitmaps.Count;
|
|
|
|
|
+ print.PrintDoc.Print();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (PRFR.Checked)
|
|
|
|
|
+ {
|
|
|
|
|
+ try
|
|
|
|
|
+ {
|
|
|
|
|
+ if (type == "box")
|
|
|
|
|
+ {
|
|
|
|
|
+ BoxReport.RegisterData(dt, "VENDORBARCODE_BOX_VIEW");
|
|
|
|
|
+ BoxReport.GetDataSource("VENDORBARCODE_BOX_VIEW").Enabled = true;
|
|
|
|
|
+ BoxReport.PrintSettings.ShowDialog = false;
|
|
|
|
|
+ BoxReport.PrintSettings.Printer = PrinterName;
|
|
|
|
|
+ BoxReport.Print();
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ BarcodeReport.RegisterData(dt, "VENDORBARCODE_VIEW");
|
|
|
|
|
+ BarcodeReport.GetDataSource("VENDORBARCODE_VIEW").Enabled = true;
|
|
|
|
|
+ BarcodeReport.PrintSettings.ShowDialog = false;
|
|
|
|
|
+ BarcodeReport.PrintSettings.Printer = PrinterName;
|
|
|
|
|
+ BarcodeReport.Print();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ catch(Exception ex)
|
|
|
|
|
+ {
|
|
|
|
|
+ MessageBox.Show(ex.Message+"打印出现错误,请检查标签文件选择是否正确");
|
|
|
|
|
+ }
|
|
|
|
|
+ dt.Clear();
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -394,11 +427,14 @@ namespace UAS_Web.tool
|
|
|
//获取矩阵图的分辨率
|
|
//获取矩阵图的分辨率
|
|
|
Graphics gr = print.PrintDoc.PrinterSettings.CreateMeasurementGraphics();
|
|
Graphics gr = print.PrintDoc.PrinterSettings.CreateMeasurementGraphics();
|
|
|
print.browser.FocusedFrame.ExecuteJavaScriptAsync("(function(value,value1){dpi=value,printType=value1})('" + gr.DpiX + "','" + PrintType + "')");
|
|
print.browser.FocusedFrame.ExecuteJavaScriptAsync("(function(value,value1){dpi=value,printType=value1})('" + gr.DpiX + "','" + PrintType + "')");
|
|
|
- if (PRXA.Checked) {
|
|
|
|
|
|
|
+ if (PRXA.Checked)
|
|
|
|
|
+ {
|
|
|
print.browser.FocusedFrame.ExecuteJavaScriptAsync("document.getElementById('confirmZplPrint').click();");
|
|
print.browser.FocusedFrame.ExecuteJavaScriptAsync("document.getElementById('confirmZplPrint').click();");
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
|
|
+ {
|
|
|
print.browser.FocusedFrame.ExecuteJavaScriptAsync("document.getElementById('confirmPicturePrint').click();");
|
|
print.browser.FocusedFrame.ExecuteJavaScriptAsync("document.getElementById('confirmPicturePrint').click();");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
print.Close();
|
|
print.Close();
|
|
|
}
|
|
}
|