Commit 7e1caa74 张东亮

共享变量变更位置

1 个父辈 003237dd
......@@ -88,6 +88,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="BLLCommon.cs" />
<Compile Include="Config.cs" />
<Compile Include="ConvertBarcode.cs" />
<Compile Include="Extension.cs" />
......@@ -103,6 +104,7 @@
<Compile Include="IO\IO_Interface.cs" />
<Compile Include="IO\KND.cs" />
<Compile Include="IO\NiRenIO.cs" />
<Compile Include="LightSource.cs" />
<Compile Include="MatchAnalysis.cs" />
<Compile Include="MonitorMouseKeyboard.cs" />
<Compile Include="NamedPipeClient.cs" />
......@@ -112,6 +114,7 @@
<Compile Include="MaterialEdit.cs" />
<Compile Include="PrintLabelShow.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ServerCommunication.cs" />
<Compile Include="Setting_Str.cs" />
<Compile Include="TextBlock.cs" />
<Compile Include="UsersLogin.cs" />
......
using Model;
using System;
using System.Collections.Generic;
using System.Drawing;
namespace BLL
{
public static class BLLCommon
{
public static BLL.Config config;
public static BLL.Extension extension;
public static BLL.PrintLabelEdit labelEdit;
public static BLL.MaterialEdit mateEdit;
public static Model.OCR ocr;
public static Asa.Camera.VisionLib cameraVision;
public static BLL.IO_Interface ioModule;
public static LightSource lightSource;
public static ServerCommunication SCMM;
public static List<string> macroKey;
public static List<string> extraKey=new List<string>();
//public static Dictionary<string, Dictionary<string, string>> extraData = new Dictionary<string, Dictionary<string, string>>();
public static int mateMaxCodeID;
public static readonly string[] CODE_SPLIT = new string[] { ",", ";", ":", "@", "#", "$", "%", "&", "-", "_", "+", "|", "!", "^", "*", "?", "/", "\\", "[Space]", "[Tab]" };
public static List<AutoGenRule> AutoGenRules;
}
}
......@@ -326,8 +326,6 @@ namespace BLL
public static MyConfig<bool> DataSource_Recursive;
[MyConfigComment("是否启用OCR")]
public static MyConfig<bool> Func_EnabledOCR=true;
[MyConfigComment("RI自动生成时是否添加编号")]
public static MyConfig<bool> AutoRIGenID = false;
//[MyConfigComment("是否启用飞浆OCR识别")]
//public static MyConfig<bool> UsePaddleOCR = true;
......
......@@ -207,13 +207,11 @@ namespace BLL
var reelID = ReadReelID();
//填充0
string text = matchPrefix + matchID;
if (Config.AutoRIGenID)
{
if (matchFill)
text += string.Format("{0:d" + matchPlace + "}", reelID);
else
text += reelID.ToString();
}
if (matchFill)
text += string.Format("{0:d" + matchPlace + "}", reelID);
else
text += reelID.ToString();
text += matchPostfix;
return text;
}
......
......@@ -2,7 +2,7 @@
using System;
using System.IO.Ports;
namespace SmartScan
namespace BLL
{
public class LightSource
{
......@@ -12,12 +12,12 @@ namespace SmartScan
public LightSource()
{
sourceFromIO = Common.config.IOLight > -1;
sourceFromIO = BLLCommon.config.IOLight > -1;
//串口光源
if (!sourceFromIO)
{
param = Common.config.LightSerialPort.Split(',');
param = BLLCommon.config.LightSerialPort.Split(',');
if (param.Length != 7) return;
port = new()
{
......@@ -43,10 +43,10 @@ namespace SmartScan
{
if (sourceFromIO)
{
if (Common.config.EnabledIO)
if (BLLCommon.config.EnabledIO)
{
var r=Common.ioModule?.WriteDO(Common.config.IOLight, BLL.Status.On);
LogNet.log.Info("Light TurnOn,IsConn:" + Common.ioModule?.IsConn+ ",WriteDO:" + r);
var r=BLLCommon.ioModule?.WriteDO(BLLCommon.config.IOLight, BLL.Status.On);
LogNet.log.Info("Light TurnOn,IsConn:" + BLLCommon.ioModule?.IsConn+ ",WriteDO:" + r);
}
}
else
......@@ -60,8 +60,8 @@ namespace SmartScan
{
if (sourceFromIO)
{
if (Common.config.EnabledIO && Common.ioModule.IsConn)
Common.ioModule?.WriteDO(Common.config.IOLight, BLL.Status.Off);
if (BLLCommon.config.EnabledIO && BLLCommon.ioModule.IsConn)
BLLCommon.ioModule?.WriteDO(BLLCommon.config.IOLight, BLL.Status.Off);
}
else
{
......
......@@ -11,13 +11,13 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace SmartScan
namespace BLL
{
public class ServerCommunication
{
public Status status = Status.Online;
static string server = Common.config.SmfServer;
static string CID = Common.config.CID;
public StoreStatus status = StoreStatus.Online;
static string server = BLLCommon.config.SmfServer;
static string CID = BLLCommon.config.CID;
List<EquipMsg> msgList = new List<EquipMsg>();
int StoreID = 1;
string StoreName = "";
......@@ -29,8 +29,8 @@ namespace SmartScan
public ServerCommunication()
{
readLazyData();
server = Common.config.SmfServer;
CID = Common.config.CID;
server = BLLCommon.config.SmfServer;
CID = BLLCommon.config.CID;
//Common.config.Save();
if (server.ToLower().StartsWith("http"))
{
......@@ -210,7 +210,7 @@ namespace SmartScan
/// 6=入库执行中,7=入仓完成,8=入仓失败
/// 9=出库执行,10=出仓完成,11=出库失败
/// </summary>
public enum Status
public enum StoreStatus
{
/// <summary>
/// 1=设备联机(正常就绪)(入库后,BOX恢复原始状态)(出库后,移载装置恢复原始状态),
......@@ -251,7 +251,7 @@ namespace SmartScan
{
public string cid;
public string type = "NEOSCAN"; //COUNTING
public Status status;
public StoreStatus status;
public int seq;
public int op;
public List<EquipMsg> msgList = new List<EquipMsg>();
......
......@@ -9,23 +9,6 @@ namespace SmartScan
{
public static FrmMain frmMain;
public static FrmWaitting frmWaitting;
public static BLL.Config config;
public static BLL.Extension extension;
public static BLL.PrintLabelEdit labelEdit;
public static BLL.MaterialEdit mateEdit;
public static Model.OCR ocr;
public static Asa.Camera.VisionLib cameraVision;
public static BLL.IO_Interface ioModule;
public static LightSource lightSource;
public static ServerCommunication SCMM;
public static List<string> macroKey;
public static List<string> extraKey=new List<string>();
//public static Dictionary<string, Dictionary<string, string>> extraData = new Dictionary<string, Dictionary<string, string>>();
public static int mateMaxCodeID;
public static readonly string[] CODE_SPLIT = new string[] { ",", ";", ":", "@", "#", "$", "%", "&", "-", "_", "+", "|", "!", "^", "*", "?", "/", "\\", "[Space]", "[Tab]" };
public static List<AutoGenRule> AutoGenRules;
}
}
using System;
using BLL;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
......@@ -19,7 +20,7 @@ namespace SmartScan
private void FrmAbout_Load(object sender, EventArgs e)
{
faceLabel2.Text = Common.config.SoftVersion;
faceLabel2.Text = BLLCommon.config.SoftVersion;
}
......
......@@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Asa.FaceControl;
using BLL;
using Model;
namespace SmartScan
......@@ -157,7 +158,7 @@ namespace SmartScan
keyTemp.Add(key, 1);
}
if (matchButton.Keys.Count == 0) {
var mateCopy = Common.mateEdit.ToCopy();
var mateCopy = BLLCommon.mateEdit.ToCopy();
var findocrm = mateCopy.Find(m => m.Ocr.Find(o => o.CodeID == this.codeID) != null);
if (findocrm != null) {
string text = Language.Dialog("ThisMatchHasOcrCantdelete");
......
......@@ -185,7 +185,7 @@ namespace SmartScan
MaterialCodeOCR ocr = new()
{
CodeID = mateCode.ID,
ID = ++Common.mateMaxCodeID,
ID = ++BLLCommon.mateMaxCodeID,
Text = s.Replace(";", "\r\n")
};
ocr.OffsetX = ocrTemp.X - codeCenter.X;
......
using System;
using BLL;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
......@@ -16,10 +17,10 @@ namespace SmartScan
{
InitializeComponent();
faceTextBox1.Text = content;
faceListBox1.Items.AddRange(Common.macroKey.ToArray());
Common.extraKey.ForEach(x =>
faceListBox1.Items.AddRange(BLLCommon.macroKey.ToArray());
BLLCommon.extraKey.ForEach(x =>
{
var has = Common.macroKey.Find(a => a == x);
var has = BLLCommon.macroKey.Find(a => a == x);
if (string.IsNullOrEmpty(has))
faceListBox1.Items.Add(x);
......
......@@ -27,24 +27,24 @@ namespace SmartScan
string version = $"{dateTime.Year%10}.{dateTime.Month}.{dateTime.Day.ToString("00")}{dateTime.Hour.ToString("00")}";
LogNet.log.Info($"===== 程序开始 {version} =====");
Common.config = new BLL.Config();
Common.config.SoftVersion = version;
BLLCommon.config = new BLL.Config();
BLLCommon.config.SoftVersion = version;
//BLL.Config.Backgrounder = back;
ExtraFileData.Init();
Common.extraKey = ExtraFileData.Titles;
BLLCommon.extraKey = ExtraFileData.Titles;
Asa.FaceControl.Language.LoadPath(FilePath.LANGUAGE_DIR);
LogNet.log.Debug("加载语言文件夹:" + FilePath.LANGUAGE_DIR);
Asa.FaceControl.Language.LoadLanguage(Common.config.Language);
Asa.FaceControl.Language.LoadLanguage(BLLCommon.config.Language);
Common.cameraVision = new Asa.Camera.VisionLib(FilePath.CONFIG_CAMERA, Common.config.EnabledCamera);
LogNet.log.Info("加载相机,数量:" + Common.cameraVision.Count);
BLLCommon.cameraVision = new Asa.Camera.VisionLib(FilePath.CONFIG_CAMERA, BLLCommon.config.EnabledCamera);
LogNet.log.Info("加载相机,数量:" + BLLCommon.cameraVision.Count);
if (Common.config.EnabledIO)
if (BLLCommon.config.EnabledIO)
{
string ip = Common.config.IOIPAddress;
Common.ioModule = new BLL.IOManage(ip,Common.config.iomodule);
Common.ioModule.Connect();
LogNet.log.Info($"加载IO模块,IP地址:{ip},iomodule:{Common.config.iomodule}");
string ip = BLLCommon.config.IOIPAddress;
BLLCommon.ioModule = new BLL.IOManage(ip, BLLCommon.config.iomodule);
BLLCommon.ioModule.Connect();
LogNet.log.Info($"加载IO模块,IP地址:{ip},iomodule:{BLLCommon.config.iomodule}");
}
if (Config.Func_EnabledOCR)
......@@ -52,10 +52,10 @@ namespace SmartScan
LogNet.log.Info("启用OCR模块");
}
Common.lightSource = new();
Common.extension = new(Common.config);
Common.labelEdit = new();
Common.mateEdit = new();
BLLCommon.lightSource = new();
BLLCommon.extension = new(BLLCommon.config);
BLLCommon.labelEdit = new();
BLLCommon.mateEdit = new();
WebService.Open();
ReadMacro();
Shortcut();
......@@ -67,12 +67,12 @@ namespace SmartScan
{
LogNet.log.Info("读取关键字文件");
LogNet.log.Debug("关键字文件路径:" + FilePath.CONFIG_MACRO_KEY);
Common.macroKey = new();
BLLCommon.macroKey = new();
if (System.IO.File.Exists(FilePath.CONFIG_MACRO_KEY))
{
string[] lines = System.IO.File.ReadAllLines(FilePath.CONFIG_MACRO_KEY);
Common.macroKey.AddRange(lines);
BLLCommon.macroKey.AddRange(lines);
LogNet.log.Debug($"添加关键字 {lines.Length} 行");
}
else
......@@ -83,7 +83,7 @@ namespace SmartScan
private void Shortcut()
{
if (!Common.config.CheckShortcut) return;
if (!BLLCommon.config.CheckShortcut) return;
string name = System.IO.Path.GetFileNameWithoutExtension(Application.ExecutablePath);
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + string.Format("\\{0}.lnk", name);
if (System.IO.File.Exists(path)) return;
......
......@@ -28,9 +28,9 @@ namespace SmartScan
private bool CheckCamera()
{
if (Common.config.EnabledCamera)
if (BLLCommon.config.EnabledCamera)
{
if (Common.cameraVision.Count <= 0)
if (BLLCommon.cameraVision.Count <= 0)
{
LogNet.log.Info("相机数量为0");
LblCameraExist.BackColor = Color.Red;
......@@ -38,7 +38,7 @@ namespace SmartScan
}
else
{
LogNet.log.Info("相机数量为" + Common.cameraVision.Count);
LogNet.log.Info("相机数量为" + BLLCommon.cameraVision.Count);
LblCameraExist.ForeColor = Color.Lime;
return true;
}
......@@ -53,18 +53,18 @@ namespace SmartScan
private bool CheckIOModule()
{
if (Common.config.EnabledIO)
if (BLLCommon.config.EnabledIO)
{
Common.ioModule.DI_Changed_Event += IoModule_DI_Changed_Event;
if (Common.ioModule.IsConn)
BLLCommon.ioModule.DI_Changed_Event += IoModule_DI_Changed_Event;
if (BLLCommon.ioModule.IsConn)
{
LogNet.log.Info($"IO模块 {Common.ioModule.IP} 连接成功");
LogNet.log.Info($"IO模块 {BLLCommon.ioModule.IP} 连接成功");
LblIOExist.ForeColor = Color.Lime;
return true;
}
else
{
LogNet.log.Info($"IO模块 {Common.ioModule.IP} 没有连接");
LogNet.log.Info($"IO模块 {BLLCommon.ioModule.IP} 没有连接");
LblIOExist.BackColor = Color.Red;
return false;
}
......@@ -85,7 +85,7 @@ namespace SmartScan
System.IO.Directory.CreateDirectory(path);
string fileName = string.Format("{0:HHmmssfff}", DateTime.Now);
switch (Common.config.HistoryImage)
switch (BLLCommon.config.HistoryImage)
{
case HistoryImage.Original:
if (PicShow.Image != null)
......@@ -141,9 +141,9 @@ namespace SmartScan
{
if (sta == null)
LogNet.log.Info("Work IO Status = null");
else if (sta.Length <= Common.config.IOTouch)
LogNet.log.Info($"Work Status.Length({sta.Length}) <= {Common.config.IOTouch}");
else if (sta[Common.config.IOTouch] == BLL.Status.Off)
else if (sta.Length <= BLLCommon.config.IOTouch)
LogNet.log.Info($"Work Status.Length({sta.Length}) <= {BLLCommon.config.IOTouch}");
else if (sta[BLLCommon.config.IOTouch] == BLL.Status.Off)
scanWork.TouchOff();
else
{
......@@ -160,8 +160,8 @@ namespace SmartScan
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 _);
BLLCommon.SCMM.SendData(content);
Bitmap labelBmp = BLLCommon.labelEdit.PrintImage(BLLCommon.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();
......@@ -212,12 +212,12 @@ namespace SmartScan
LogNet.log.Info(str);
SaveResult(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));
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));
//SaveRetrospect(labelBmp, barcode);
if (Common.config.PrintCompletedClear)
Common.extension.Clear();
if (BLLCommon.config.PrintCompletedClear)
BLLCommon.extension.Clear();
}
catch (Exception ex)
{
......@@ -233,41 +233,41 @@ namespace SmartScan
Close();
return;
}
Common.SCMM = new();
BLLCommon.SCMM = new();
if (!BLL.Config.Backgrounder)
{
monitor = new();
Application.AddMessageFilter(monitor);
monitor.Timeout += Monitor_Timeout;
monitor.Start(Common.config.OperateTimeout);
monitor.Start(BLLCommon.config.OperateTimeout);
}
scanWork = new();
LblVersion.Text = Common.config.SoftVersion;
LblUserName.Text = Common.config.UserName;
LblVersion.Text = BLLCommon.config.SoftVersion;
LblUserName.Text = BLLCommon.config.UserName;
if (LblUserName.Text == "None user")
LblUserName.Visible = false;
BtnSet.Enabled = Common.config.UserLevel == UserLevel.Admin;
BtnSet.Enabled = BLLCommon.config.UserLevel == UserLevel.Admin;
//扩展面板
PnlExtension.Width = Common.config.ExtensionWidth;
PnlExtension.Width = BLLCommon.config.ExtensionWidth;
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);
BLLCommon.extension.Printing += Extension_Printing;
BLLCommon.extension.SaveRetrospect += Extension_SaveRetrospect;
BLLCommon.extension.LoadPanel(PnlExtension, BLLCommon.macroKey);
//语言
CboLanguage.Items.AddRange(Language.Name);
CboLanguage.SelectedText = Common.config.Language;
Common.AutoGenRules = AutoGenRule.LoadFile();
if (Common.config.OpenMaximize) Maximize();
CboLanguage.SelectedText = BLLCommon.config.Language;
BLLCommon.AutoGenRules = AutoGenRule.LoadFile();
if (BLLCommon.config.OpenMaximize) Maximize();
if (CheckCamera() && CheckIOModule())
{
BtnStart.Enabled = true;
if (Common.config.OpenStartWork)
if (BLLCommon.config.OpenStartWork)
{
BtnStart.HoldPress = true;
scanWork.Open();
......@@ -293,7 +293,7 @@ namespace SmartScan
if (rtn)
{
Show();
monitor.Start(Common.config.OperateTimeout);
monitor.Start(BLLCommon.config.OperateTimeout);
}
else
{
......@@ -305,7 +305,7 @@ namespace SmartScan
private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
{
monitor?.Stop();
Common.extension?.Dispose();
BLLCommon.extension?.Dispose();
//if (Common.config.IOLight == -1)
// Common.SerialPort.Close();
}
......@@ -317,11 +317,11 @@ namespace SmartScan
private void CboLanguage_SelectedIndexChanged(object sender, EventArgs e)
{
if (Common.config.Language != CboLanguage.Text)
if (BLLCommon.config.Language != CboLanguage.Text)
{
Language.LoadLanguage(CboLanguage.Text);
Common.config.Language = CboLanguage.Text;
Common.config.Save();
BLLCommon.config.Language = CboLanguage.Text;
BLLCommon.config.Save();
}
}
......@@ -428,7 +428,7 @@ namespace SmartScan
});
return;
}
Common.SCMM.ShowMsg(msg, 3, msgType.INFO);
BLLCommon.SCMM.ShowMsg(msg, 3, msgType.INFO);
Common.frmWaitting.SetMessage(msg);
Application.DoEvents();
}
......
......@@ -11,6 +11,7 @@ using System.Reflection;
using System.Web.UI.WebControls;
using DocumentFormat.OpenXml.ExtendedProperties;
using DocumentFormat.OpenXml.Wordprocessing;
using BLL;
namespace SmartScan
{
......@@ -262,7 +263,7 @@ namespace SmartScan
string genLine(Dictionary<string, object> pairs)
{
List<string> lines = new List<string>();
foreach (var item in Common.macroKey)
foreach (var item in BLLCommon.macroKey)
{
if (pairs.ContainsKey(item))
{
......@@ -287,13 +288,13 @@ namespace SmartScan
string[] pairs = item.Split(':');
if (pairs != null && pairs.Length > 0)
{
if (Common.macroKey.Contains(pairs[0]))
if (BLLCommon.macroKey.Contains(pairs[0]))
{
dic[pairs[0]] = pairs[1];
}
}
}
foreach (var item in Common.macroKey)
foreach (var item in BLLCommon.macroKey)
{
if (dic.ContainsKey(item))
{
......@@ -319,7 +320,7 @@ namespace SmartScan
{
if (i > 0)
return true;
else if (!Common.macroKey.Contains(pairs[0])) { return false; }
else if (!BLLCommon.macroKey.Contains(pairs[0])) { return false; }
}
}
......@@ -329,11 +330,11 @@ namespace SmartScan
}
bool checkHasMacroKey(Dictionary<string, object> content)
{
for (int i = 0; i < Common.macroKey.Count; i++)
for (int i = 0; i < BLLCommon.macroKey.Count; i++)
{
if (i > 0)
return true;
else if (!content.ContainsKey(Common.macroKey[i])) { return false; }
else if (!content.ContainsKey(BLLCommon.macroKey[i])) { return false; }
}
return true;
}
......@@ -342,7 +343,7 @@ namespace SmartScan
SaveFileDialog dlg = new() { Filter = "CSV文件|*.csv" };
if (dlg.ShowDialog() == DialogResult.Cancel) return;
StringBuilder content = new StringBuilder();
content.AppendLine(string.Join(",", Common.macroKey));
content.AppendLine(string.Join(",", BLLCommon.macroKey));
var path = fileFull[index];
{
string json = System.IO.File.ReadAllText(path.codePath);
......@@ -370,7 +371,7 @@ namespace SmartScan
SaveFileDialog dlg = new() { Filter = "CSV文件|*.csv" };
if (dlg.ShowDialog() == DialogResult.Cancel) return;
StringBuilder content = new StringBuilder();
content.AppendLine(string.Join(",", Common.macroKey));
content.AppendLine(string.Join(",", BLLCommon.macroKey));
foreach (var path in fileFull)
{
string json = System.IO.File.ReadAllText(path.codePath);
......
......@@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using Asa.FaceControl;
using System.Windows.Forms;
using BLL;
namespace SmartScan
{
......@@ -59,7 +60,7 @@ namespace SmartScan
menu[button].Save();
string text = Language.Dialog(Model.LanguageDialogKey.SAVE_SUCCEED);
new FaceMessageBox("", text, MessageBoxButtons.OK).ShowDialog();
Common.extension.Update();
BLLCommon.extension.Update();
DialogResult = DialogResult.OK;
}
......@@ -74,7 +75,7 @@ namespace SmartScan
menu[button].Save();
string text = Language.Dialog(Model.LanguageDialogKey.SAVE_SUCCEED);
new FaceMessageBox("", text, MessageBoxButtons.OK).ShowDialog();
Common.extension.Update();
BLLCommon.extension.Update();
}
}
}
......@@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using Asa.FaceControl;
using System.Windows.Forms;
using BLL;
namespace SmartScan
{
......@@ -25,8 +26,8 @@ namespace SmartScan
bool rtn = usersLogin.Logion(user, pwd, out Model.UserLevel level);
if (rtn)
{
Common.config.UserName = user;
Common.config.UserLevel = level;
BLLCommon.config.UserName = user;
BLLCommon.config.UserLevel = level;
DialogResult = DialogResult.OK;
Close();
}
......
......@@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using Asa.FaceControl;
using System.Windows.Forms;
using BLL;
namespace SmartScan
{
......@@ -74,7 +75,7 @@ namespace SmartScan
//语言
CboLanguage.Items.Clear();
CboLanguage.Items.AddRange(Language.Name);
CboLanguage.SelectedText = Common.config.Language;
CboLanguage.SelectedText = BLLCommon.config.Language;
}
private void BtnMenu_Click(object sender, EventArgs e)
......@@ -112,7 +113,7 @@ namespace SmartScan
menu[button].Save();
string text = Language.Dialog(Model.LanguageDialogKey.SAVE_SUCCEED);
new FaceMessageBox("", text, MessageBoxButtons.OK).ShowDialog();
Common.extension.Update();
BLLCommon.extension.Update();
DialogResult = DialogResult.OK;
WindowState = FormWindowState.Minimized;
}
......@@ -131,16 +132,16 @@ namespace SmartScan
menu[button].Save();
string text = Language.Dialog(Model.LanguageDialogKey.SAVE_SUCCEED);
new FaceMessageBox("", text, MessageBoxButtons.OK).ShowDialog();
Common.extension.Update();
BLLCommon.extension.Update();
}
private void CboLanguage_SelectedIndexChanged(object sender, EventArgs e)
{
if (Common.config.Language != CboLanguage.Text)
if (BLLCommon.config.Language != CboLanguage.Text)
{
Language.LoadLanguage(CboLanguage.Text);
Common.config.Language = CboLanguage.Text;
Common.config.Save();
BLLCommon.config.Language = CboLanguage.Text;
BLLCommon.config.Save();
FrmSet_Load(this, EventArgs.Empty);
}
}
......
......@@ -161,9 +161,9 @@ namespace SmartScan
private static void Exit()
{
LogNet.log.Info("=====准备退出...=====");
Common.lightSource.Close();
Common.ioModule?.Close();
Common.cameraVision?.Dispose();
BLLCommon.lightSource.Close();
BLLCommon.ioModule?.Close();
BLLCommon.cameraVision?.Dispose();
WebService.Close();
LogNet.log.Info("=====程序结束=====\r\n");
}
......
using Asa.FaceControl;
using BLL;
using Model;
using System;
using System.Collections.Generic;
......@@ -37,13 +38,13 @@ namespace SmartScan
Common.frmMain.Controls["BtnTriggerIO"].Visible = true;
LogNet.log.Info("Work Start");
if (Common.config.EnabledCamera)
Common.cameraVision?.Open();
if (BLLCommon.config.EnabledCamera)
BLLCommon.cameraVision?.Open();
if (Common.config.TriggerOpenLight) //触发时才打开光源
Common.lightSource?.TurnOff();
if (BLLCommon.config.TriggerOpenLight) //触发时才打开光源
BLLCommon.lightSource?.TurnOff();
else
Common.lightSource?.TurnOn();
BLLCommon.lightSource?.TurnOn();
}
public void Close()
......@@ -55,10 +56,10 @@ namespace SmartScan
Common.frmMain.Controls["BtnTriggerIO"].Visible = false;
LogNet.log.Info("Work Stop");
if (Common.config.EnabledCamera)
Common.cameraVision?.Close();
if (BLLCommon.config.EnabledCamera)
BLLCommon.cameraVision?.Close();
Common.lightSource?.TurnOff();
BLLCommon.lightSource?.TurnOff();
}
public void TouchOff()
......@@ -74,7 +75,7 @@ namespace SmartScan
btnMatchedName.Invoke(delegate() {
if (!BLL.Config.Backgrounder)
btnMatchedName.Visible = false;
Common.extension.Clear();
BLLCommon.extension.Clear();
});
var t = Task.Run(() =>
......@@ -136,7 +137,7 @@ namespace SmartScan
if (!BLL.Config.Backgrounder)
btnMatchedName.Visible = false;
Common.extension.Clear();
BLLCommon.extension.Clear();
workCodeInfo = new();
workCodeKeyword = new(StringComparer.OrdinalIgnoreCase);
originalCodeText = code;
......@@ -214,20 +215,20 @@ namespace SmartScan
{
LogNet.log.Info("Work GetCodeInfo");
if (Common.config.EnabledCamera)
if (BLLCommon.config.EnabledCamera)
{
if (Common.config.TriggerOpenLight)
if (BLLCommon.config.TriggerOpenLight)
{
Common.lightSource.TurnOn();
BLLCommon.lightSource.TurnOn();
System.Threading.Thread.Sleep(2000); //光源打开有一个由暗变亮的过程
}
workCodeInfo = Common.cameraVision.GetBarCode(out List<Bitmap> image);
workCodeInfo = BLLCommon.cameraVision.GetBarCode(out List<Bitmap> image);
if (image.Count > 0 && !BLL.Config.Backgrounder) picShow.Image = image[0];
if (image.Count > 0)
Common.mateEdit.CurrntBitmap = image[0];
BLLCommon.mateEdit.CurrntBitmap = image[0];
if (Common.config.TriggerOpenLight)
Common.lightSource.TurnOff();
if (BLLCommon.config.TriggerOpenLight)
BLLCommon.lightSource.TurnOff();
return true;
}
else
......@@ -244,12 +245,12 @@ namespace SmartScan
Bitmap bmp = null;
bmp = new(filename);
workCodeInfo = Common.cameraVision.GetBarCode(bmp);
workCodeInfo = BLLCommon.cameraVision.GetBarCode(bmp);
Common.frmMain.Invoke(delegate ()
{
if (!BLL.Config.Backgrounder)
picShow.Image = bmp;
Common.mateEdit.CurrntBitmap = bmp;
BLLCommon.mateEdit.CurrntBitmap = bmp;
});
return true;
}
......@@ -282,9 +283,9 @@ namespace SmartScan
{
LogNet.log.Info("Work MatchingTemplate");
if (workCodeInfo.Count == 0) return false;
originalCodeText = Common.cameraVision.GetBarCodeText(workCodeInfo);
originalCodeText = BLLCommon.cameraVision.GetBarCodeText(workCodeInfo);
bool rtn = Common.mateEdit.MatchingTemplate(workCodeInfo, Common.config.DefaultMaterialName,false, out string mateName, out workCodeKeyword, out originalCodeIsUsed);
bool rtn = BLLCommon.mateEdit.MatchingTemplate(workCodeInfo, BLLCommon.config.DefaultMaterialName,false, out string mateName, out workCodeKeyword, out originalCodeIsUsed);
BLL.MatchAnalysis.ShowResult();
Common.frmMain.Invoke(delegate ()
{
......@@ -315,10 +316,10 @@ namespace SmartScan
private void SetKey(bool hasMatch)
{
LogNet.log.Info("Work SetKey hasMatch:"+ hasMatch);
Common.extension.SetKey(originalCodeText, workCodeKeyword, hasMatch,out _);
BLLCommon.extension.SetKey(originalCodeText, workCodeKeyword, hasMatch,out _);
if (workCodeKeyword.Count == 0) return;
if (Common.config.PromptAfterPrinting && !BLL.Config.Backgrounder)
if (BLLCommon.config.PromptAfterPrinting && !BLL.Config.Backgrounder)
{
string text = Language.Dialog("SelectPrintContent");
new FaceMessageBox("", text, MessageBoxButtons.OK).ShowDialog();
......
......@@ -16,7 +16,7 @@ namespace SmartScan
{
InitializeComponent();
Asa.FaceControl.Language.SetLanguage(this);
BtnCameraImage.Enabled = Common.cameraVision == null ? false : Common.cameraVision.Count > 0;
BtnCameraImage.Enabled = BLLCommon.cameraVision == null ? false : BLLCommon.cameraVision.Count > 0;
}
public Asa.FaceControl.FacePanel GetPanel()
......@@ -30,19 +30,19 @@ namespace SmartScan
private void BtnOpenLight_Click(object sender, EventArgs e)
{
Common.lightSource.TurnOn();
BLLCommon.lightSource.TurnOn();
}
private void BtnCloseLight_Click(object sender, EventArgs e)
{
Common.lightSource.TurnOff();
BLLCommon.lightSource.TurnOff();
}
private void BtnCameraImage_Click(object sender, EventArgs e)
{
Common.cameraVision.Open();
Bitmap[] result = Common.cameraVision.GetImage();
Common.cameraVision.Close();
BLLCommon.cameraVision.Open();
Bitmap[] result = BLLCommon.cameraVision.GetImage();
BLLCommon.cameraVision.Close();
if (result.Length == 0) return;
bmp = result[0];
LstCode.Items.Clear();
......@@ -64,7 +64,7 @@ namespace SmartScan
private void BtnScanCode_Click(object sender, EventArgs e)
{
if (bmp == null) return;
List<CameraVisionLib.Model.BarcodeInfo> info = Common.cameraVision.GetBarCode(bmp);
List<CameraVisionLib.Model.BarcodeInfo> info = BLLCommon.cameraVision.GetBarCode(bmp);
LstCode.Items.Clear();
PicShow.CodeCenterClear();
string[] arr = new string[info.Count];
......
using Asa.FaceControl;
using BLL;
using System;
using System.Windows.Forms;
......@@ -30,8 +31,8 @@ namespace SmartScan
this.codeText = codeText;
this.codeType = codeType;
CboKeyword.Items.AddRange(Common.macroKey.ToArray());
CboMatchingSplit.Items.AddRange(Common.CODE_SPLIT);
CboKeyword.Items.AddRange(BLLCommon.macroKey.ToArray());
CboMatchingSplit.Items.AddRange(BLLCommon.CODE_SPLIT);
NudStart.Maximum = codeLength;
NudLength.Maximum = codeLength;
ChkMatchingStart.Checked = match.MatchStart;
......
......@@ -84,7 +84,7 @@ namespace SmartScan
}
CboDataKey.Items.Clear();
CboDataKey.Items.AddRange(Common.macroKey.ToArray());
CboDataKey.Items.AddRange(BLLCommon.macroKey.ToArray());
CboDataKey.SelectedIndex = 0;
if (!string.IsNullOrEmpty(Config.DataSource_DataKey))
......@@ -108,7 +108,7 @@ namespace SmartScan
Config.DataSource_DataTitle = CboDataTitle.Text;
Config.DataSource_Recursive = ChkRecursive.Checked;
ExtraFileData.Init();
Common.extraKey = ExtraFileData.Titles;
BLLCommon.extraKey = ExtraFileData.Titles;
}
private void BtnSelectFile_Click(object sender, EventArgs e)
......
......@@ -84,7 +84,7 @@ namespace SmartScan
}
CboDataKey.Items.Clear();
CboDataKey.Items.AddRange(Common.macroKey.ToArray());
CboDataKey.Items.AddRange(BLLCommon.macroKey.ToArray());
CboDataKey.SelectedIndex = 0;
if (!string.IsNullOrEmpty(Config.DataSource_DataKey))
......@@ -108,7 +108,7 @@ namespace SmartScan
Config.DataSource_DataTitle = CboDataTitle.Text;
Config.DataSource_Recursive = ChkRecursive.Checked;
ExtraFileData.Init();
Common.extraKey = ExtraFileData.Titles;
BLLCommon.extraKey = ExtraFileData.Titles;
}
private void BtnSelectFile_Click(object sender, EventArgs e)
......
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using BLL;
using Model;
namespace SmartScan
......@@ -12,15 +13,15 @@ namespace SmartScan
public UsrMacro()
{
InitializeComponent();
keyCopy = new(Common.macroKey);
keyCopy = new(BLLCommon.macroKey);
LstKey.Items.AddRange(keyCopy.ToArray());
setRIkey();
TxtReelIDMatch.Text = Common.config.ReelIDMatch;
TxtPrefix.Text = Common.config.ReelIDPrefix;
TxtPostfix.Text = Common.config.ReelIDPostfix;
NumReelIDPlaces.Value = Common.config.ReelIDPlaces;
ChkReelIDFillZero.Checked = Common.config.ReelIDFillZero;
ChkResetidbydate.Checked = Common.config.ReelIDAutoResetByDate;
TxtReelIDMatch.Text = BLLCommon.config.ReelIDMatch;
TxtPrefix.Text = BLLCommon.config.ReelIDPrefix;
TxtPostfix.Text = BLLCommon.config.ReelIDPostfix;
NumReelIDPlaces.Value = BLLCommon.config.ReelIDPlaces;
ChkReelIDFillZero.Checked = BLLCommon.config.ReelIDFillZero;
ChkResetidbydate.Checked = BLLCommon.config.ReelIDAutoResetByDate;
Asa.FaceControl.Language.SetLanguage(this);
}
......@@ -31,24 +32,24 @@ namespace SmartScan
public void Save()
{
Common.macroKey.Clear();
Common.macroKey.AddRange(keyCopy);
System.IO.File.WriteAllLines(FilePath.CONFIG_MACRO_KEY, Common.macroKey.ToArray());
Common.config.ReelIDMatch = TxtReelIDMatch.Text;
Common.config.ReelIDPrefix = TxtPrefix.Text;
Common.config.ReelIDPostfix = TxtPostfix.Text;
Common.config.ReelIDPlaces = (int)NumReelIDPlaces.Value;
Common.config.ReelIDFillZero = ChkReelIDFillZero.Checked;
Common.config.ReelIDAutoResetByDate = ChkResetidbydate.Checked;
Common.config.Save();
BLLCommon.macroKey.Clear();
BLLCommon.macroKey.AddRange(keyCopy);
System.IO.File.WriteAllLines(FilePath.CONFIG_MACRO_KEY, BLLCommon.macroKey.ToArray());
BLLCommon.config.ReelIDMatch = TxtReelIDMatch.Text;
BLLCommon.config.ReelIDPrefix = TxtPrefix.Text;
BLLCommon.config.ReelIDPostfix = TxtPostfix.Text;
BLLCommon.config.ReelIDPlaces = (int)NumReelIDPlaces.Value;
BLLCommon.config.ReelIDFillZero = ChkReelIDFillZero.Checked;
BLLCommon.config.ReelIDAutoResetByDate = ChkResetidbydate.Checked;
BLLCommon.config.Save();
}
void setRIkey() {
LstKey.Items.Clear();
LstKey.Items.AddRange(keyCopy.ToArray());
for (int i = 0; i < LstKey.Items.Count; i++)
{
if (LstKey.Items[i] == Common.config.ReelIDKeyWord)
if (LstKey.Items[i] == BLLCommon.config.ReelIDKeyWord)
LstKey.Items[i] = "[RI]" + LstKey.Items[i];
}
}
......@@ -135,10 +136,10 @@ namespace SmartScan
private void btn_setriid_Click(object sender, EventArgs e)
{
if (LstKey.SelectedIndex == -1) return;
if (keyCopy[LstKey.SelectedIndex] == Common.config.ReelIDKeyWord)
Common.config.ReelIDKeyWord = "";
if (keyCopy[LstKey.SelectedIndex] == BLLCommon.config.ReelIDKeyWord)
BLLCommon.config.ReelIDKeyWord = "";
else
Common.config.ReelIDKeyWord = keyCopy[LstKey.SelectedIndex];
BLLCommon.config.ReelIDKeyWord = keyCopy[LstKey.SelectedIndex];
setRIkey();
}
......
......@@ -19,10 +19,10 @@ namespace SmartScan
{
InitializeComponent();
//BtnOcrCode.Enabled = Config.Func_EnabledOCR;
LstMate.Items.AddRange(Common.mateEdit.Name);
mateCopy = Common.mateEdit.ToCopy();
LstMate.Items.AddRange(BLLCommon.mateEdit.Name);
mateCopy = BLLCommon.mateEdit.ToCopy();
Language.SetLanguage(this);
BtnCameraImage.Enabled = Common.cameraVision.Count > 0;
BtnCameraImage.Enabled = BLLCommon.cameraVision.Count > 0;
LstMate.SelectedFirst();
}
......@@ -33,7 +33,7 @@ namespace SmartScan
public void Save()
{
Common.mateEdit.Save(ref mateCopy);
BLLCommon.mateEdit.Save(ref mateCopy);
}
......@@ -117,7 +117,7 @@ namespace SmartScan
{
if (LstMate.SelectedIndex == -1) return;
mateIndex = LstMate.SelectedIndex;
Common.mateMaxCodeID = mateCopy[mateIndex].GetMaxID();
BLLCommon.mateMaxCodeID = mateCopy[mateIndex].GetMaxID();
ImgShow.Image = mateCopy[mateIndex].Image;
ImgShow.CodeCenterClear();
......@@ -196,19 +196,19 @@ namespace SmartScan
private void BtnOpenLight_Click(object sender, EventArgs e)
{
Common.lightSource.TurnOn();
BLLCommon.lightSource.TurnOn();
}
private void BtnCloseLight_Click(object sender, EventArgs e)
{
Common.lightSource.TurnOff();
BLLCommon.lightSource.TurnOff();
}
private void BtnCameraImage_Click(object sender, EventArgs e)
{
Common.cameraVision.Open();
Bitmap[] result = Common.cameraVision.GetImage();
Common.cameraVision.Close();
BLLCommon.cameraVision.Open();
Bitmap[] result = BLLCommon.cameraVision.GetImage();
BLLCommon.cameraVision.Close();
if (result.Length == 0) return;
bmp = result[0];
......@@ -247,7 +247,7 @@ namespace SmartScan
{
return;
}
List<CameraVisionLib.Model.BarcodeInfo> info = Common.cameraVision.GetBarCode(bmp);
List<CameraVisionLib.Model.BarcodeInfo> info = BLLCommon.cameraVision.GetBarCode(bmp);
LstCode.Items.Clear();
ImgShow.CodeCenterClear();
mateCopy[mateIndex].Match.Clear();
......@@ -255,7 +255,7 @@ namespace SmartScan
mateCopy[mateIndex].Ocr.Clear();
mateCopy[mateIndex].PrimaryCode = -1;
mateCopy[mateIndex].State = TemplateState.Unsaved;
Common.mateMaxCodeID = info.Count;
BLLCommon.mateMaxCodeID = info.Count;
PointF[] lst = new PointF[info.Count];
for (int i = 0; i < info.Count; i++)
......@@ -282,7 +282,7 @@ namespace SmartScan
//保存需要识别ocr的区域
bmp?.Save(@"ocrt.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
string[] regOcrCodes = PaddleOCRHelper.StartTest("..\\ocrt.jpg").Split(';');
int startidx = Common.mateMaxCodeID + 1;
int startidx = BLLCommon.mateMaxCodeID + 1;
foreach (var ocr in regOcrCodes)
{
if (string.IsNullOrEmpty(ocr)) continue;
......
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Asa.FaceControl;
using BLL;
using Model;
namespace SmartScan
......@@ -27,9 +28,9 @@ namespace SmartScan
labelShow.LabelSizeShow += LabelShow_LabelSizeShow;
labelShow.FieldSizeChanged += LabelShow_FieldSizeChanged;
LstLabel.Items.AddRange(Common.labelEdit.Name);
LstLabel.Items.AddRange(BLLCommon.labelEdit.Name);
CboFieldType.Items.AddRange(Enum.GetNames(typeof(PrintLabelFieldType)));
labelCopy = Common.labelEdit.ToCopy();
labelCopy = BLLCommon.labelEdit.ToCopy();
Language.SetLanguage(this);
LstLabel.SelectedFirst();
}
......@@ -41,7 +42,7 @@ namespace SmartScan
public void Save()
{
Common.labelEdit.Save(ref labelCopy);
BLLCommon.labelEdit.Save(ref labelCopy);
}
......@@ -174,7 +175,7 @@ namespace SmartScan
private void BtnPrintTest_Click(object sender, EventArgs e)
{
if (labelIndex == -1) return;
Common.labelEdit.PrintTest(labelCopy[labelIndex]);
BLLCommon.labelEdit.PrintTest(labelCopy[labelIndex]);
}
private void BtnAddField_Click(object sender, EventArgs e)
......
......@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Windows.Forms;
using Asa.FaceControl;
using BLL;
using Model;
namespace SmartScan
......@@ -14,32 +15,32 @@ namespace SmartScan
//打印机
LstPrinter.Items.AddRange(Printer.AllName);
LstPrinter.Text = Common.config.PrinterName;
if (Common.config.PrintLandscape)
LstPrinter.Text = BLLCommon.config.PrinterName;
if (BLLCommon.config.PrintLandscape)
RdoLandscape.Checked = true;
else
RdoVertical.Checked = true;
//图像保存
((FaceRadioBox)facePanel1.Controls["Rdo" + Common.config.HistoryImage.ToString()]).Checked = true;
((FaceRadioBox)facePanel1.Controls["Rdo" + BLLCommon.config.HistoryImage.ToString()]).Checked = true;
//6个复选框
ChkSelectPN.Checked = Common.config.SelectHttpPN;
ChkLabelEmptyCheck.Checked = Common.config.LabelEmptyCheck;
ChkOpenEnterWork.Checked = Common.config.OpenStartWork;
ChkPrintCompletedClear.Checked = Common.config.PrintCompletedClear;
ChkOpenMaximize.Checked = Common.config.OpenMaximize;
ChkTriggerOpenLight.Checked = Common.config.TriggerOpenLight;
ChkPromptAfterPrinting.Checked = Common.config.PromptAfterPrinting;
ChkAutoPrint.Checked = Common.config.AutoPrint;
ChkSelectPN.Checked = BLLCommon.config.SelectHttpPN;
ChkLabelEmptyCheck.Checked = BLLCommon.config.LabelEmptyCheck;
ChkOpenEnterWork.Checked = BLLCommon.config.OpenStartWork;
ChkPrintCompletedClear.Checked = BLLCommon.config.PrintCompletedClear;
ChkOpenMaximize.Checked = BLLCommon.config.OpenMaximize;
ChkTriggerOpenLight.Checked = BLLCommon.config.TriggerOpenLight;
ChkPromptAfterPrinting.Checked = BLLCommon.config.PromptAfterPrinting;
ChkAutoPrint.Checked = BLLCommon.config.AutoPrint;
//默认标签
LstLabel.Items.AddRange(Common.labelEdit.Name);
LstLabel.Text = Common.config.DefaultPrintLabel;
LstLabel.Items.AddRange(BLLCommon.labelEdit.Name);
LstLabel.Text = BLLCommon.config.DefaultPrintLabel;
//优先模板
LstMate.Items.AddRange(Common.mateEdit.Name);
LstMate.Text = Common.config.DefaultMaterialName;
LstMate.Items.AddRange(BLLCommon.mateEdit.Name);
LstMate.Text = BLLCommon.config.DefaultMaterialName;
Language.SetLanguage(this);
}
......@@ -52,58 +53,58 @@ namespace SmartScan
public void Save()
{
//保存打印机
Common.config.PrintLandscape = RdoLandscape.Checked;
BLLCommon.config.PrintLandscape = RdoLandscape.Checked;
if (LstPrinter.SelectedIndex == -1)
{
if (LstPrinter.Items.Count == 1)
Common.config.PrinterName = LstPrinter.Items[0];
BLLCommon.config.PrinterName = LstPrinter.Items[0];
}
else
{
Common.config.PrinterName = LstPrinter.Text;
BLLCommon.config.PrinterName = LstPrinter.Text;
}
//追溯图像保存
if (RdoOriginal.Checked)
Common.config.HistoryImage = HistoryImage.Original;
BLLCommon.config.HistoryImage = HistoryImage.Original;
else if (RdoCondense.Checked)
Common.config.HistoryImage = HistoryImage.Condense;
BLLCommon.config.HistoryImage = HistoryImage.Condense;
else if (RdoNoImage.Checked)
Common.config.HistoryImage = HistoryImage.NoImage;
BLLCommon.config.HistoryImage = HistoryImage.NoImage;
//默认打印标签
if (LstLabel.SelectedIndex == -1)
{
if (LstLabel.Items.Count == 1)
Common.config.DefaultPrintLabel = LstLabel.Items[0];
BLLCommon.config.DefaultPrintLabel = LstLabel.Items[0];
}
else
{
Common.config.DefaultPrintLabel = LstLabel.Text;
BLLCommon.config.DefaultPrintLabel = LstLabel.Text;
}
//优先匹配模板
if (LstMate.SelectedIndex == -1)
{
if (LstMate.Items.Count == 1)
Common.config.DefaultMaterialName = LstMate.Items[0];
BLLCommon.config.DefaultMaterialName = LstMate.Items[0];
}
else
{
Common.config.DefaultMaterialName = LstMate.Text;
BLLCommon.config.DefaultMaterialName = LstMate.Text;
}
//6个复选框
Common.config.SelectHttpPN = ChkSelectPN.Checked;
Common.config.LabelEmptyCheck = ChkLabelEmptyCheck.Checked;
Common.config.OpenStartWork = ChkOpenEnterWork.Checked;
Common.config.OpenMaximize = ChkOpenMaximize.Checked;
Common.config.PrintCompletedClear = ChkPrintCompletedClear.Checked;
Common.config.TriggerOpenLight = ChkTriggerOpenLight.Checked;
Common.config.PromptAfterPrinting = ChkPromptAfterPrinting.Checked;
Common.config.AutoPrint = ChkAutoPrint.Checked;
BLLCommon.config.SelectHttpPN = ChkSelectPN.Checked;
BLLCommon.config.LabelEmptyCheck = ChkLabelEmptyCheck.Checked;
BLLCommon.config.OpenStartWork = ChkOpenEnterWork.Checked;
BLLCommon.config.OpenMaximize = ChkOpenMaximize.Checked;
BLLCommon.config.PrintCompletedClear = ChkPrintCompletedClear.Checked;
BLLCommon.config.TriggerOpenLight = ChkTriggerOpenLight.Checked;
BLLCommon.config.PromptAfterPrinting = ChkPromptAfterPrinting.Checked;
BLLCommon.config.AutoPrint = ChkAutoPrint.Checked;
Common.config.Save();
BLLCommon.config.Save();
}
}
}
......@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Windows.Forms;
using Asa.FaceControl;
using BLL;
using Model;
namespace SmartScan
......@@ -14,32 +15,32 @@ namespace SmartScan
//打印机
LstPrinter.Items.AddRange(Printer.AllName);
LstPrinter.Text = Common.config.PrinterName;
if (Common.config.PrintLandscape)
LstPrinter.Text = BLLCommon.config.PrinterName;
if (BLLCommon.config.PrintLandscape)
RdoLandscape.Checked = true;
else
RdoVertical.Checked = true;
//图像保存
((FaceRadioBox)facePanel1.Controls["Rdo" + Common.config.HistoryImage.ToString()]).Checked = true;
((FaceRadioBox)facePanel1.Controls["Rdo" + BLLCommon.config.HistoryImage.ToString()]).Checked = true;
//6个复选框
ChkSelectPN.Checked = Common.config.SelectHttpPN;
ChkLabelEmptyCheck.Checked = Common.config.LabelEmptyCheck;
ChkOpenEnterWork.Checked = Common.config.OpenStartWork;
ChkPrintCompletedClear.Checked = Common.config.PrintCompletedClear;
ChkOpenMaximize.Checked = Common.config.OpenMaximize;
ChkTriggerOpenLight.Checked = Common.config.TriggerOpenLight;
ChkPromptAfterPrinting.Checked = Common.config.PromptAfterPrinting;
ChkAutoPrint.Checked = Common.config.AutoPrint;
ChkSelectPN.Checked = BLLCommon.config.SelectHttpPN;
ChkLabelEmptyCheck.Checked = BLLCommon.config.LabelEmptyCheck;
ChkOpenEnterWork.Checked = BLLCommon.config.OpenStartWork;
ChkPrintCompletedClear.Checked = BLLCommon.config.PrintCompletedClear;
ChkOpenMaximize.Checked = BLLCommon.config.OpenMaximize;
ChkTriggerOpenLight.Checked = BLLCommon.config.TriggerOpenLight;
ChkPromptAfterPrinting.Checked = BLLCommon.config.PromptAfterPrinting;
ChkAutoPrint.Checked = BLLCommon.config.AutoPrint;
//默认标签
LstLabel.Items.AddRange(Common.labelEdit.Name);
LstLabel.Text = Common.config.DefaultPrintLabel;
LstLabel.Items.AddRange(BLLCommon.labelEdit.Name);
LstLabel.Text = BLLCommon.config.DefaultPrintLabel;
//优先模板
LstMate.Items.AddRange(Common.mateEdit.Name);
LstMate.Text = Common.config.DefaultMaterialName;
LstMate.Items.AddRange(BLLCommon.mateEdit.Name);
LstMate.Text = BLLCommon.config.DefaultMaterialName;
Language.SetLanguage(this);
}
......@@ -52,58 +53,58 @@ namespace SmartScan
public void Save()
{
//保存打印机
Common.config.PrintLandscape = RdoLandscape.Checked;
BLLCommon.config.PrintLandscape = RdoLandscape.Checked;
if (LstPrinter.SelectedIndex == -1)
{
if (LstPrinter.Items.Count == 1)
Common.config.PrinterName = LstPrinter.Items[0];
BLLCommon.config.PrinterName = LstPrinter.Items[0];
}
else
{
Common.config.PrinterName = LstPrinter.Text;
BLLCommon.config.PrinterName = LstPrinter.Text;
}
//追溯图像保存
if (RdoOriginal.Checked)
Common.config.HistoryImage = HistoryImage.Original;
BLLCommon.config.HistoryImage = HistoryImage.Original;
else if (RdoCondense.Checked)
Common.config.HistoryImage = HistoryImage.Condense;
BLLCommon.config.HistoryImage = HistoryImage.Condense;
else if (RdoNoImage.Checked)
Common.config.HistoryImage = HistoryImage.NoImage;
BLLCommon.config.HistoryImage = HistoryImage.NoImage;
//默认打印标签
if (LstLabel.SelectedIndex == -1)
{
if (LstLabel.Items.Count == 1)
Common.config.DefaultPrintLabel = LstLabel.Items[0];
BLLCommon.config.DefaultPrintLabel = LstLabel.Items[0];
}
else
{
Common.config.DefaultPrintLabel = LstLabel.Text;
BLLCommon.config.DefaultPrintLabel = LstLabel.Text;
}
//优先匹配模板
if (LstMate.SelectedIndex == -1)
{
if (LstMate.Items.Count == 1)
Common.config.DefaultMaterialName = LstMate.Items[0];
BLLCommon.config.DefaultMaterialName = LstMate.Items[0];
}
else
{
Common.config.DefaultMaterialName = LstMate.Text;
BLLCommon.config.DefaultMaterialName = LstMate.Text;
}
//6个复选框
Common.config.SelectHttpPN = ChkSelectPN.Checked;
Common.config.LabelEmptyCheck = ChkLabelEmptyCheck.Checked;
Common.config.OpenStartWork = ChkOpenEnterWork.Checked;
Common.config.OpenMaximize = ChkOpenMaximize.Checked;
Common.config.PrintCompletedClear = ChkPrintCompletedClear.Checked;
Common.config.TriggerOpenLight = ChkTriggerOpenLight.Checked;
Common.config.PromptAfterPrinting = ChkPromptAfterPrinting.Checked;
Common.config.AutoPrint = ChkAutoPrint.Checked;
BLLCommon.config.SelectHttpPN = ChkSelectPN.Checked;
BLLCommon.config.LabelEmptyCheck = ChkLabelEmptyCheck.Checked;
BLLCommon.config.OpenStartWork = ChkOpenEnterWork.Checked;
BLLCommon.config.OpenMaximize = ChkOpenMaximize.Checked;
BLLCommon.config.PrintCompletedClear = ChkPrintCompletedClear.Checked;
BLLCommon.config.TriggerOpenLight = ChkTriggerOpenLight.Checked;
BLLCommon.config.PromptAfterPrinting = ChkPromptAfterPrinting.Checked;
BLLCommon.config.AutoPrint = ChkAutoPrint.Checked;
Common.config.Save();
BLLCommon.config.Save();
}
}
}
......@@ -130,7 +130,6 @@
<DependentUpon>UsrLabeling.cs</DependentUpon>
</Compile>
<Compile Include="ScanWork.cs" />
<Compile Include="ServerCommunication.cs" />
<Compile Include="SetControl\FrmDataFilePreview.cs">
<SubType>Form</SubType>
</Compile>
......@@ -254,7 +253,6 @@
<Compile Include="SetControl\UsrCodeExtractList.Designer.cs">
<DependentUpon>UsrCodeExtractList.cs</DependentUpon>
</Compile>
<Compile Include="LightSource.cs" />
<Compile Include="SetControl\UsrUserAccount.cs">
<SubType>UserControl</SubType>
</Compile>
......
using System;
using BLL;
using System;
using System.Windows.Forms;
namespace SmartScan
......@@ -10,7 +11,7 @@ namespace SmartScan
if (BLL.Config.Backgrounder) //后台模式不需要登录
return true;
if (Common.config.EnabledUserLogin)
if (BLLCommon.config.EnabledUserLogin)
{
FrmUsersLogin frm = new();
if (frm.ShowDialog() == DialogResult.OK)
......@@ -25,8 +26,8 @@ namespace SmartScan
}
else
{
Common.config.UserName = "None user";
Common.config.UserLevel = Model.UserLevel.Admin;
BLLCommon.config.UserName = "None user";
BLLCommon.config.UserLevel = Model.UserLevel.Admin;
return true;
}
}
......
......@@ -6,6 +6,7 @@ using Model;
using System.Runtime.Serialization.Formatters.Binary;
using System.Drawing;
using System.Collections.Generic;
using BLL;
namespace SmartScan
{
......@@ -60,17 +61,17 @@ namespace SmartScan
List<CameraVisionLib.Model.BarcodeInfo> workCodeInfo = new();
Dictionary<string, string> workCodeKeyword;// = new(StringComparer.OrdinalIgnoreCase);
bool[] originalCodeIsUsed = null;
workCodeInfo = Common.cameraVision.GetBarCode(bitmap);
workCodeInfo = BLLCommon.cameraVision.GetBarCode(bitmap);
if (workCodeInfo.Count == 0)
return new WebResultCode() { ErrorCode = -1, Msg = "扫码失败" };
Common.mateEdit.CurrntBitmap = bitmap;
bool rtn = Common.mateEdit.MatchingTemplate(workCodeInfo, Common.config.DefaultMaterialName, false, out string mateName, out workCodeKeyword, out originalCodeIsUsed);
BLLCommon.mateEdit.CurrntBitmap = bitmap;
bool rtn = BLLCommon.mateEdit.MatchingTemplate(workCodeInfo, BLLCommon.config.DefaultMaterialName, false, out string mateName, out workCodeKeyword, out originalCodeIsUsed);
LogNet.log.Info("Work SetKey hasMatch:" + rtn);
WebResultCode webResultCode = null;
if (!Common.extension.SetKey(null, workCodeKeyword, rtn, out string errmsg))
if (!BLLCommon.extension.SetKey(null, workCodeKeyword, rtn, out string errmsg))
{
webResultCode = new WebResultCode() { ErrorCode = -2, Msg = errmsg };
......
using System;
using BLL;
using System;
using System.ServiceModel.Web;
namespace SmartScan
......@@ -13,7 +14,7 @@ namespace SmartScan
{
try
{
string url = Common.config.WebService;
string url = BLLCommon.config.WebService;
if (string.IsNullOrWhiteSpace(url))
{
Model.LogNet.log.Info("WebService没有配置,不开启");
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!