Commit a0f57fba LN

增加日志打印

1 个父辈 1f6d5f1d
......@@ -84,7 +84,7 @@ namespace OnlineStore.DeviceLibrary
lineConnect = new LineConnect(config.GetStoreId(),config.CID);
mainTimer.Enabled = false;
}
private int vcount = 0;
/// <summary>
/// 视觉比较是否有料
/// </summary>
......@@ -92,6 +92,7 @@ namespace OnlineStore.DeviceLibrary
/// <returns>true=有料,false=无料</returns>
public bool VisionComp(out Dictionary<string, bool> exist)
{
bool returnResult = false;
exist = new Dictionary<string, bool>();
if (String.IsNullOrEmpty(Config.Camera_Name))
{
......@@ -101,19 +102,30 @@ namespace OnlineStore.DeviceLibrary
{
if (StoreManager.Store. vision != null)
{
vcount++;
bool result= StoreManager.Store.vision.FeatureCompare(Config.Camera_Name, out exist);
if (!result)
{
LogUtil.error(Name + " VisionComp ["+ Config.Camera_Name + "] =" + result);
}
if (exist != null)
{
{
string name = "LeftTop";
exist.TryGetValue(name, out bool value);
if (value)
{
return true;
returnResult= true;
}
string str = result ? "有料\r\n" : "无料\r\n";
if (exist != null)
{
List<string> keys = new List<string>(exist.Keys);
foreach (string key in keys)
{
str += key + "=" + exist[key] + ";\r\n";
}
}
LogUtil.info(Name + "VisionComp "+ vcount + " [" + Config.Camera_Name + "] 结果:" + str);
}
}
}
......@@ -121,7 +133,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(Name + "VisionLibCom 出错:" + ex.ToString());
}
return false;
return returnResult;
}
public void MoveAxisConfig()
{
......
......@@ -139,12 +139,13 @@ namespace OnlineStore.DeviceLibrary
{
try
{
string vfile = ConfigAppSettings.GetValue(Setting_Init.VisionConfigFile, "RollingLogFileAppender");
string vfile = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.VisionConfigFile);
if (!String.IsNullOrEmpty(vfile))
{
vision = new Asa.Camera.VisionLib(Application.StartupPath + vfile);
vision = new Asa.Camera.VisionLib(vfile, "RollingLogFileAppender");
vision.Open();
vision.FeatureOriginal();
LogUtil.info(" InitVisionLib [" + vfile + "] [RollingLogFileAppender] 完成");
}
}
catch (Exception ex)
......
......@@ -215,14 +215,14 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = false;
return wait;
}
public static WaitResultInfo WaitVisionComp()
{
WaitResultInfo wait = new WaitResultInfo();
wait.CanWhileMoveCount = 0;
wait.WaitType = 8;
wait.IsEnd = false;
return wait;
}
//public static WaitResultInfo WaitVisionComp()
//{
// WaitResultInfo wait = new WaitResultInfo();
// wait.CanWhileMoveCount = 0;
// wait.WaitType = 8;
// wait.IsEnd = false;
// return wait;
//}
//public static WaitResultInfo WaitHeight(int height)
//{
// WaitResultInfo wait = new WaitResultInfo();
......
......@@ -295,7 +295,7 @@
this.btnImgSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnImgSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnImgSave.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnImgSave.Location = new System.Drawing.Point(278, 560);
this.btnImgSave.Location = new System.Drawing.Point(278, 550);
this.btnImgSave.Name = "btnImgSave";
this.btnImgSave.Size = new System.Drawing.Size(105, 38);
this.btnImgSave.TabIndex = 284;
......@@ -308,7 +308,7 @@
this.btnFcomp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnFcomp.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnFcomp.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnFcomp.Location = new System.Drawing.Point(132, 560);
this.btnFcomp.Location = new System.Drawing.Point(132, 550);
this.btnFcomp.Name = "btnFcomp";
this.btnFcomp.Size = new System.Drawing.Size(105, 38);
this.btnFcomp.TabIndex = 283;
......@@ -321,7 +321,7 @@
this.btnForig.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnForig.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnForig.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnForig.Location = new System.Drawing.Point(20, 560);
this.btnForig.Location = new System.Drawing.Point(20, 550);
this.btnForig.Name = "btnForig";
this.btnForig.Size = new System.Drawing.Size(105, 38);
this.btnForig.TabIndex = 282;
......@@ -335,7 +335,7 @@
this.lblLSend.AutoSize = true;
this.lblLSend.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblLSend.ForeColor = System.Drawing.Color.Green;
this.lblLSend.Location = new System.Drawing.Point(13, 489);
this.lblLSend.Location = new System.Drawing.Point(13, 493);
this.lblLSend.Name = "lblLSend";
this.lblLSend.Size = new System.Drawing.Size(0, 17);
this.lblLSend.TabIndex = 280;
......@@ -346,7 +346,7 @@
this.lblSend.AutoSize = true;
this.lblSend.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblSend.ForeColor = System.Drawing.Color.Green;
this.lblSend.Location = new System.Drawing.Point(13, 513);
this.lblSend.Location = new System.Drawing.Point(13, 517);
this.lblSend.Name = "lblSend";
this.lblSend.Size = new System.Drawing.Size(0, 17);
this.lblSend.TabIndex = 278;
......@@ -386,7 +386,7 @@
this.groupBox1.Controls.Add(this.label43);
this.groupBox1.Controls.Add(this.label42);
this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(505, 336);
this.groupBox1.Location = new System.Drawing.Point(505, 340);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(476, 136);
this.groupBox1.TabIndex = 217;
......@@ -566,7 +566,7 @@
this.groupBox2.Controls.Add(this.button6);
this.groupBox2.Controls.Add(this.button3);
this.groupBox2.Controls.Add(this.button5);
this.groupBox2.Location = new System.Drawing.Point(11, 394);
this.groupBox2.Location = new System.Drawing.Point(11, 398);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(476, 78);
this.groupBox2.TabIndex = 276;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!