Commit 09dfe401 LN

1

2 个父辈 1e2af832 f660fd77
......@@ -739,9 +739,9 @@ namespace AutoScanAndLabel
{
FileName = path,
//WorkingDirectory = System.IO.Path.Combine(Application.StartupPath, "\\NeoScan"),
Verb = "runas" // 这里设置为 "runas" 表示以管理员身份运行
//Verb = "runas" // 这里设置为 "runas" 表示以管理员身份运行
};
proes.StartInfo.UseShellExecute = false;
//proes.StartInfo.UseShellExecute = false;
proes.Start();
}
catch (Exception ex)
......
......@@ -86,7 +86,7 @@ namespace DeviceLibrary
try
{
if (fileContainer==null)
if (fileContainer == null)
{
}
......
......@@ -34,7 +34,14 @@ namespace DeviceLibrary
dpi = 300;
}
print = new Asa.PrintLabel(Application.StartupPath + "\\Label", dpi);
print.PrintStatusChanged += Print_PrintStatusChanged;
}
private void Print_PrintStatusChanged(Asa.PrintLabel.PrinterStatus sta, string msg)
{
LogUtil.info($"打印机状态:{sta}, msg:{msg}");
}
public static CustPrinterStatus LastPrintStatus = CustPrinterStatus.Unknown;
public bool Connection(string port)
{
......@@ -74,35 +81,40 @@ namespace DeviceLibrary
public bool Print(string labelname, Dictionary<string, string> data, out string msg)
{
print.LoadLabel(labelname);
if (printDevice==PrintDevice.TSC)
if (printDevice == PrintDevice.TSC)
{
LogUtil.error($"TSC_打印数据:{JsonHelper.SerializeObject(data)}" );
LogUtil.error($"TSC_打印数据:{JsonHelper.SerializeObject(data)}");
TscConfig tscConfig = new TscConfig();
tscConfig.Offset = ConfigHelper.Config.Get("Tsc_Offset", -17D);
tscConfig.Speed = ConfigHelper.Config.Get("Tsc_Speed", 9);
tscConfig.Density = ConfigHelper.Config.Get("Tsc_Density", 12);
tscConfig.GapOffset = ConfigHelper.Config.Get("Tsc_GapOffset", 0);
tscConfig.Gap = ConfigHelper.Config.Get("Tsc_Gap", 3);
if (!print.PrintToTsc_New(data,tscConfig, out TscStauts tscStauts,out Bitmap bmp))
if (!print.PrintToTsc_New(data, tscConfig, out TscStauts tscStauts, out Bitmap bmp))
{
msg = $"打印失败:{tscStauts.ToString()}";
LogUtil.error("打印失败原因:" + tscStauts.ToString());
return false;
}
if (bmp!=null)
if (bmp != null)
{
string cid = ConfigHelper.Config.Get("CID");
_ = UnifiedDataHandler.PostSmfImageAsync(bmp,new Dictionary<string, string> { {"cid",cid+"_2" } }, bmp.Width, bmp.Height);
}
_ = UnifiedDataHandler.PostSmfImageAsync(bmp, new Dictionary<string, string> { { "cid", cid + "_2" } }, bmp.Width, bmp.Height);
}
msg = $"打印成功";
return true;
}
else if (printDevice == PrintDevice.Windows) {
print.Print(data);
msg = "";
return true;
}
else
{
{
var bmp = print.PrintPreview(data);
if (!zebraManger.PrintImage(bmp, out msg))
{
if (msg== "上一个标签尚未移走")
if (msg == "上一个标签尚未移走")
{
msg = crc.GetString("Res0224", "上一个标签尚未移走");
}
......
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!