Commit 6e600050 刘韬

1

1 个父辈 a1ec7f8c
......@@ -12,6 +12,7 @@ namespace BLL
public class Extension : IDisposable
{
public event IExtension.PrintDelegate Printing;
public event IExtension.PrintDelegate SaveRetrospect;
private readonly IExtension currentExtension;
private readonly Dictionary<string, IExtension> dicExtension;
......@@ -53,8 +54,12 @@ namespace BLL
{ "General", General }
};
for (int i = 0; i < dicExtension.Count; i++)
{
dicExtension.ElementAt(i).Value.Printing += new IExtension.PrintDelegate(
delegate (Dictionary<string, string> content) { Printing?.Invoke(content); });
dicExtension.ElementAt(i).Value.SaveRetrospect += new IExtension.PrintDelegate(
delegate (Dictionary<string, string> content) { SaveRetrospect?.Invoke(content); });
}
dicControls = new()
{
......
......@@ -16,6 +16,7 @@ namespace BLL
public class Alcoelectro : IExtension
{
public event IExtension.PrintDelegate Printing;
public event IExtension.PrintDelegate SaveRetrospect;
private List<ExtensionControl> extensions;
private ServerContent[] serverContent;
......@@ -373,6 +374,7 @@ namespace BLL
LogNet.log.Info("打印标签前的ID:" + reelID);
reelID++;
SaveReelID();
SaveRetrospect?.Invoke(key);
Printing?.Invoke(key);
}
......
......@@ -18,6 +18,7 @@ namespace BLL
public class General : IExtension
{
public event IExtension.PrintDelegate Printing;
public event IExtension.PrintDelegate SaveRetrospect;
private Config config;
private int reelID = 0;
......@@ -76,7 +77,7 @@ namespace BLL
return;
Application.DoEvents();
if (config.AutoPrint && hasMatch)
{
//if (CanPrint())
......@@ -89,7 +90,7 @@ namespace BLL
var newid = GetHttpReelID(key);
if (string.IsNullOrEmpty(newid))
return false;
key["ReelID"] = newid;
key["ReelID"] = newid;
}
for (int i = 0; i < extensions.Count; i++)
......@@ -97,6 +98,7 @@ namespace BLL
if (extensions[i].Key.ToLower() == "reelid")
extensions[i].Control.Text = key["reelid"];
}
SaveRetrospect?.Invoke(key);
return true;
}
......@@ -196,7 +198,7 @@ namespace BLL
key.Add(extensions[i].Key, extensions[i].Control.Text);
}
var keys =new List<string>(key.Keys);
Printing?.Invoke(key);
}
private string GetHttpReelID(Dictionary<string, string> key)
......
......@@ -16,6 +16,7 @@ namespace BLL
public class Inventec : IExtension
{
public event IExtension.PrintDelegate Printing;
public event IExtension.PrintDelegate SaveRetrospect;
private List<ExtensionControl> extensions;
private readonly Dictionary<string, int> reelID;
......@@ -375,6 +376,7 @@ namespace BLL
reelID[reelIDKey]++;
SaveReelID();
}
SaveRetrospect?.Invoke(key);
Printing?.Invoke(key);
//Clear();
......
......@@ -19,6 +19,7 @@ namespace BLL
{
public event IExtension.PrintDelegate Printing;
public event IExtension.PrintDelegate SaveRetrospect;
private Config config;
private int reelID = 0;
private List<ExtensionControl> extensions;
......@@ -191,7 +192,7 @@ namespace BLL
if (string.IsNullOrEmpty(key[kk]))
key[kk] = "NA";
}
SaveRetrospect?.Invoke(key);
Printing?.Invoke(key);
}
......
......@@ -16,6 +16,7 @@ namespace BLL
public class NanRui : IExtension
{
public event IExtension.PrintDelegate Printing;
public event IExtension.PrintDelegate SaveRetrospect;
private string[][] jsonData;
private string mesIP;
......
......@@ -16,6 +16,7 @@ namespace BLL
public class PanaCIM : IExtension
{
public event IExtension.PrintDelegate Printing;
public event IExtension.PrintDelegate SaveRetrospect;
private List<ExtensionControl> extensions;
private readonly Dictionary<string, int> reelID;
......@@ -330,6 +331,7 @@ namespace BLL
reelID[reelIDKey]++;
SaveReelID();
}
SaveRetrospect?.Invoke(key);
Printing?.Invoke(key);
//Clear();
......
......@@ -168,7 +168,7 @@ namespace BLL
if (TemplateExtract(i, code, out keyword, out isCodeUsed))
{
if (string.IsNullOrEmpty(mateName))
mateName = mateTemp[firstIndex].Name;
mateName = mateTemp[i].Name;
if (!analyisMode)
return true;
}
......@@ -183,7 +183,7 @@ namespace BLL
if (TemplateExtract(i, code, out keyword, out isCodeUsed))
{
if (string.IsNullOrEmpty(mateName))
mateName = mateTemp[firstIndex].Name;
mateName = mateTemp[i].Name;
if (!analyisMode)
return true;
}
......
......@@ -59,6 +59,7 @@ namespace Model
{
RestClient client = new(url) { Timeout = timeout };
client.UseSerializer(new CustSerialize());
RestRequest request = new(Method.POST);
request.AddHeader("Content-Type", "application/json");
if (headers != null)
......@@ -69,10 +70,10 @@ namespace Model
}
}
request.AddJsonBody(jsonobject);
IRestResponse response = client.Execute(request);
IRestResponse response = client.Execute(request);
string s = response.Content;
if (wlog)
LogNet.log.Info("Return:" + s);
LogNet.log.Info("Return:" + s);
return s;
}
private static string FormatContent(string s)
......
......@@ -7,6 +7,7 @@ namespace Model
{
public delegate void PrintDelegate(Dictionary<string, string> content);
public event PrintDelegate Printing;
public event PrintDelegate SaveRetrospect;
public void Clear();
......
......@@ -149,20 +149,43 @@ namespace SmartScan
}
}
private void Extension_Printing(Dictionary<string, string> content)
private void Extension_SaveRetrospect(Dictionary<string, string> content)
{
try
{
string str = "打印内容:";
string str = "追溯内容:";
foreach (string key in content.Keys)
str += string.Format("({0}:{1})", key, content[key]);
LogNet.log.Info(str);
Common.SCMM.SendData(content);
Bitmap labelBmp = Common.labelEdit.PrintImage(Common.config.DefaultPrintLabel, content, out _);
//Common.labelEdit.PrintLast(Common.config.DefaultPrintLabel, Common.config.PrinterName, Common.config.PrintLandscape, content, out string[] barcode);
//LogNet.log.Info(string.Format("打印标签 Label[{0}] Printer[{1}]", Common.config.DefaultPrintLabel, Common.config.PrinterName));
var barcode = content.Values.ToArray();
SaveRetrospect(labelBmp, barcode);
if (Common.config.PrintCompletedClear)
Common.extension.Clear();
}
catch (Exception ex)
{
LogNet.log.Error("Extension_Printing", ex);
}
}
private void Extension_Printing(Dictionary<string, string> content)
{
try
{
string str = "打印内容:";
foreach (string key in content.Keys)
str += string.Format("({0}:{1})", key, content[key]);
LogNet.log.Info(str);
//Common.SCMM.SendData(content);
//Bitmap labelBmp = Common.labelEdit.PrintImage(Common.config.DefaultPrintLabel, content, out _);
Common.labelEdit.PrintLast(Common.config.DefaultPrintLabel, Common.config.PrinterName, Common.config.PrintLandscape, content, out string[] barcode);
LogNet.log.Info(string.Format("打印标签 Label[{0}] Printer[{1}]", Common.config.DefaultPrintLabel, Common.config.PrinterName));
SaveRetrospect(labelBmp, barcode);
//SaveRetrospect(labelBmp, barcode);
if (Common.config.PrintCompletedClear)
Common.extension.Clear();
......@@ -200,6 +223,7 @@ namespace SmartScan
PnlExtension.Left = Width - PnlExtension.Width - 12;
PicShow.Width = PnlExtension.Left - PicShow.Left - 6;
Common.extension.Printing += Extension_Printing;
Common.extension.SaveRetrospect += Extension_SaveRetrospect;
Common.extension.LoadPanel(PnlExtension, Common.macroKey);
//语言
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!