Commit 59dbae0f 刘韬

修正二次检查功能的BUG

1 个父辈 fb295ce8
......@@ -387,9 +387,9 @@ namespace BLL
return bmp;
}
public void PrintLast(string labelName, string printName, bool printLandscape, Dictionary<string, string> text, out string[] barCode)
public void PrintLast(string labelName, string printName, bool printLandscape, Dictionary<string, string> text, out List<string> barCode)
{
barCode = null;
barCode = new List<string>();
int index = labelTemp.FindIndex(match => match.Name == labelName);
if (index == -1)
{
......@@ -398,7 +398,7 @@ namespace BLL
}
SizeF sf;
barCode = new string[labelTemp[index].Field.Count];
for (int i = 0; i < labelTemp[index].Field.Count; i++)
{
PrintLabelField field = labelTemp[index].Field[i];
......@@ -415,8 +415,8 @@ namespace BLL
{
sf = ObjConversion.MmToPx(field.Rectangle.Size);
field.Image = ConvertBarcode.StrToCode(field.Type, field.PrintText, sf);
barCode.Add(field.PrintText);
}
barCode[i] = field.PrintText;
}
using System.Drawing.Printing.PrintDocument print = new();
......
......@@ -883,30 +883,14 @@ namespace SmartScan
private void Extension_Printing(Dictionary<string, string> content)
{
string str = "打印内容:";
//if (lastContent!=null)
//{
// bool isSame = CompareContent(content);
// if (isSame)
// {
// BLLCommon.extension.labelText = "OK";
// lastContent.Clear();
// }
// else
// {
// BLLCommon.extension.labelText = "NG";
// }
//}
string aa = "";
try
{
foreach (string key in content.Keys)
{// 提取简写键(保留原键的层级结构)
string shortKey = key.Split('\t').First(); // 输出 "RID" 或 "QTY"
str += string.Format("({0}:{1})", shortKey, content[key]);
aa += string.Format("({0}:{1})", shortKey, content[key]);
}
LogNet.log.Info("打印内容:"+JsonConvert.SerializeObject(content));
SaveResult(content);
//Bitmap labelBmp = Common.labelEdit.PrintImage(Common.config.DefaultPrintLabel, content, out _);
BLLCommon.labelEdit.PrintLast(BLLCommon.config.DefaultPrintLabel, BLLCommon.config.PrinterName, BLLCommon.config.PrintLandscape, content, out List<string> barcode);
LogNet.log.Info(string.Format("打印标签 Label[{0}] Printer[{1}] Barcode[{2}]", BLLCommon.config.DefaultPrintLabel, BLLCommon.config.PrinterName, string.Join(",", barcode)));
try
{
// 确保目录存在
......@@ -917,18 +901,14 @@ namespace SmartScan
}
// 覆盖文件内容(只保留最新日志)
File.WriteAllText(FilePath.CONFIG_Code_Value, $"{aa}");
File.WriteAllText(FilePath.CONFIG_Code_Value, string.Join("\r\n", barcode));
}
catch (Exception ex)
{
LogNet.log.Error($"写入文件失败: {ex.Message}");
}
LogNet.log.Info(str);
SaveResult(content);
//Bitmap labelBmp = Common.labelEdit.PrintImage(Common.config.DefaultPrintLabel, content, out _);
BLLCommon.labelEdit.PrintLast(BLLCommon.config.DefaultPrintLabel, BLLCommon.config.PrinterName, BLLCommon.config.PrintLandscape, content, out string[] barcode);
LogNet.log.Info(string.Format("打印标签 Label[{0}] Printer[{1}]", BLLCommon.config.DefaultPrintLabel, BLLCommon.config.PrinterName));
var bmp = BLLCommon.labelEdit.PrintImage(BLLCommon.config.DefaultPrintLabel, content, out _);
if (bmp != null)
{
......
......@@ -262,6 +262,8 @@ namespace SmartScan
// 读取文件内容
string fileContent = File.ReadAllText(FilePath.CONFIG_Code_Value);
LogNet.log.Info("扫描到条码:"+string.Join(",", codeTexts));
LogNet.log.Info("在以下条码中匹配:"+fileContent);
// 检查文件内容是否包含任一条码文本
foreach (string codeText in codeTexts)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!