Commit 84f375e7 LN

托盘检测图片保存单独配置

1 个父辈 d5242713
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmLineStore)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmLineStore));
this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage1 = new System.Windows.Forms.TabPage();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.chbSaveImg = new System.Windows.Forms.CheckBox(); this.chbSaveImg = new System.Windows.Forms.CheckBox();
this.chbSaveImage = new System.Windows.Forms.CheckBox(); this.chbSaveImage = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
...@@ -96,6 +97,7 @@ ...@@ -96,6 +97,7 @@
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator20 = new System.Windows.Forms.ToolStripSeparator();
this.托盘初始化ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.托盘初始化ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator14 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator14 = new System.Windows.Forms.ToolStripSeparator();
this.查看托盘信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.查看托盘信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
...@@ -121,7 +123,6 @@ ...@@ -121,7 +123,6 @@
this.toolStripSeparator19 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator19 = new System.Windows.Forms.ToolStripSeparator();
this.自动保存托盘信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.自动保存托盘信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.新托盘检测逻辑ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.新托盘检测逻辑ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator20 = new System.Windows.Forms.ToolStripSeparator();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
...@@ -154,6 +155,7 @@ ...@@ -154,6 +155,7 @@
// //
// tabPage1 // tabPage1
// //
this.tabPage1.Controls.Add(this.checkBox1);
this.tabPage1.Controls.Add(this.chbSaveImg); this.tabPage1.Controls.Add(this.chbSaveImg);
this.tabPage1.Controls.Add(this.chbSaveImage); this.tabPage1.Controls.Add(this.chbSaveImage);
this.tabPage1.Controls.Add(this.groupBox1); this.tabPage1.Controls.Add(this.groupBox1);
...@@ -171,11 +173,23 @@ ...@@ -171,11 +173,23 @@
this.tabPage1.Text = "状态信息"; this.tabPage1.Text = "状态信息";
this.tabPage1.UseVisualStyleBackColor = true; this.tabPage1.UseVisualStyleBackColor = true;
// //
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.checkBox1.Location = new System.Drawing.Point(1151, 150);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(140, 24);
this.checkBox1.TabIndex = 286;
this.checkBox1.Text = "保存托盘检测图片";
this.checkBox1.UseVisualStyleBackColor = true;
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged_1);
//
// chbSaveImg // chbSaveImg
// //
this.chbSaveImg.AutoSize = true; this.chbSaveImg.AutoSize = true;
this.chbSaveImg.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.chbSaveImg.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbSaveImg.Location = new System.Drawing.Point(1187, 145); this.chbSaveImg.Location = new System.Drawing.Point(1028, 150);
this.chbSaveImg.Name = "chbSaveImg"; this.chbSaveImg.Name = "chbSaveImg";
this.chbSaveImg.Size = new System.Drawing.Size(112, 24); this.chbSaveImg.Size = new System.Drawing.Size(112, 24);
this.chbSaveImg.TabIndex = 285; this.chbSaveImg.TabIndex = 285;
...@@ -187,7 +201,7 @@ ...@@ -187,7 +201,7 @@
// //
this.chbSaveImage.AutoSize = true; this.chbSaveImage.AutoSize = true;
this.chbSaveImage.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.chbSaveImage.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbSaveImage.Location = new System.Drawing.Point(1059, 145); this.chbSaveImage.Location = new System.Drawing.Point(900, 150);
this.chbSaveImage.Name = "chbSaveImage"; this.chbSaveImage.Name = "chbSaveImage";
this.chbSaveImage.Size = new System.Drawing.Size(112, 24); this.chbSaveImage.Size = new System.Drawing.Size(112, 24);
this.chbSaveImage.TabIndex = 203; this.chbSaveImage.TabIndex = 203;
...@@ -769,80 +783,85 @@ ...@@ -769,80 +783,85 @@
// toolStripSeparator6 // toolStripSeparator6
// //
this.toolStripSeparator6.Name = "toolStripSeparator6"; this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(177, 6); this.toolStripSeparator6.Size = new System.Drawing.Size(173, 6);
this.toolStripSeparator6.Visible = false; this.toolStripSeparator6.Visible = false;
// //
// 二维码学习ToolStripMenuItem // 二维码学习ToolStripMenuItem
// //
this.二维码学习ToolStripMenuItem.Name = "二维码学习ToolStripMenuItem"; this.二维码学习ToolStripMenuItem.Name = "二维码学习ToolStripMenuItem";
this.二维码学习ToolStripMenuItem.Size = new System.Drawing.Size(180, 26); this.二维码学习ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.二维码学习ToolStripMenuItem.Text = "二维码学习"; this.二维码学习ToolStripMenuItem.Text = "二维码学习";
this.二维码学习ToolStripMenuItem.Click += new System.EventHandler(this.二维码学习ToolStripMenuItem_Click); this.二维码学习ToolStripMenuItem.Click += new System.EventHandler(this.二维码学习ToolStripMenuItem_Click);
// //
// toolStripSeparator7 // toolStripSeparator7
// //
this.toolStripSeparator7.Name = "toolStripSeparator7"; this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(177, 6); this.toolStripSeparator7.Size = new System.Drawing.Size(173, 6);
// //
// iO模块状态ToolStripMenuItem // iO模块状态ToolStripMenuItem
// //
this.iO模块状态ToolStripMenuItem.Name = "iO模块状态ToolStripMenuItem"; this.iO模块状态ToolStripMenuItem.Name = "iO模块状态ToolStripMenuItem";
this.iO模块状态ToolStripMenuItem.Size = new System.Drawing.Size(180, 26); this.iO模块状态ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.iO模块状态ToolStripMenuItem.Text = "IO模块状态"; this.iO模块状态ToolStripMenuItem.Text = "IO模块状态";
this.iO模块状态ToolStripMenuItem.Click += new System.EventHandler(this.iO模块状态ToolStripMenuItem_Click); this.iO模块状态ToolStripMenuItem.Click += new System.EventHandler(this.iO模块状态ToolStripMenuItem_Click);
// //
// toolStripSeparator9 // toolStripSeparator9
// //
this.toolStripSeparator9.Name = "toolStripSeparator9"; this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(177, 6); this.toolStripSeparator9.Size = new System.Drawing.Size(173, 6);
// //
// toolStripMenuItem2 // toolStripMenuItem2
// //
this.toolStripMenuItem2.Name = "toolStripMenuItem2"; this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 26); this.toolStripMenuItem2.Size = new System.Drawing.Size(176, 26);
this.toolStripMenuItem2.Text = "查看异常列表"; this.toolStripMenuItem2.Text = "查看异常列表";
this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click_1); this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click_1);
// //
// toolStripSeparator13 // toolStripSeparator13
// //
this.toolStripSeparator13.Name = "toolStripSeparator13"; this.toolStripSeparator13.Name = "toolStripSeparator13";
this.toolStripSeparator13.Size = new System.Drawing.Size(177, 6); this.toolStripSeparator13.Size = new System.Drawing.Size(173, 6);
// //
// toolStripMenuItem3 // toolStripMenuItem3
// //
this.toolStripMenuItem3.Name = "toolStripMenuItem3"; this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(180, 26); this.toolStripMenuItem3.Size = new System.Drawing.Size(176, 26);
this.toolStripMenuItem3.Text = "查看禁用托盘"; this.toolStripMenuItem3.Text = "查看禁用托盘";
this.toolStripMenuItem3.Click += new System.EventHandler(this.toolStripMenuItem3_Click); this.toolStripMenuItem3.Click += new System.EventHandler(this.toolStripMenuItem3_Click);
// //
// toolStripSeparator20
//
this.toolStripSeparator20.Name = "toolStripSeparator20";
this.toolStripSeparator20.Size = new System.Drawing.Size(173, 6);
//
// 托盘初始化ToolStripMenuItem // 托盘初始化ToolStripMenuItem
// //
this.托盘初始化ToolStripMenuItem.Name = "托盘初始化ToolStripMenuItem"; this.托盘初始化ToolStripMenuItem.Name = "托盘初始化ToolStripMenuItem";
this.托盘初始化ToolStripMenuItem.Size = new System.Drawing.Size(180, 26); this.托盘初始化ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.托盘初始化ToolStripMenuItem.Text = "托盘编码"; this.托盘初始化ToolStripMenuItem.Text = "托盘编码";
this.托盘初始化ToolStripMenuItem.Click += new System.EventHandler(this.托盘初始化ToolStripMenuItem_Click); this.托盘初始化ToolStripMenuItem.Click += new System.EventHandler(this.托盘初始化ToolStripMenuItem_Click);
// //
// toolStripSeparator14 // toolStripSeparator14
// //
this.toolStripSeparator14.Name = "toolStripSeparator14"; this.toolStripSeparator14.Name = "toolStripSeparator14";
this.toolStripSeparator14.Size = new System.Drawing.Size(177, 6); this.toolStripSeparator14.Size = new System.Drawing.Size(173, 6);
// //
// 查看托盘信息ToolStripMenuItem // 查看托盘信息ToolStripMenuItem
// //
this.查看托盘信息ToolStripMenuItem.Name = "查看托盘信息ToolStripMenuItem"; this.查看托盘信息ToolStripMenuItem.Name = "查看托盘信息ToolStripMenuItem";
this.查看托盘信息ToolStripMenuItem.Size = new System.Drawing.Size(180, 26); this.查看托盘信息ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.查看托盘信息ToolStripMenuItem.Text = "查看托盘信息"; this.查看托盘信息ToolStripMenuItem.Text = "查看托盘信息";
this.查看托盘信息ToolStripMenuItem.Click += new System.EventHandler(this.btnTrayInfo_Click); this.查看托盘信息ToolStripMenuItem.Click += new System.EventHandler(this.btnTrayInfo_Click);
// //
// toolStripSeparator12 // toolStripSeparator12
// //
this.toolStripSeparator12.Name = "toolStripSeparator12"; this.toolStripSeparator12.Name = "toolStripSeparator12";
this.toolStripSeparator12.Size = new System.Drawing.Size(177, 6); this.toolStripSeparator12.Size = new System.Drawing.Size(173, 6);
// //
// 清空托盘信息ToolStripMenuItem // 清空托盘信息ToolStripMenuItem
// //
this.清空托盘信息ToolStripMenuItem.Name = "清空托盘信息ToolStripMenuItem"; this.清空托盘信息ToolStripMenuItem.Name = "清空托盘信息ToolStripMenuItem";
this.清空托盘信息ToolStripMenuItem.Size = new System.Drawing.Size(180, 26); this.清空托盘信息ToolStripMenuItem.Size = new System.Drawing.Size(176, 26);
this.清空托盘信息ToolStripMenuItem.Text = "清空托盘信息"; this.清空托盘信息ToolStripMenuItem.Text = "清空托盘信息";
this.清空托盘信息ToolStripMenuItem.Click += new System.EventHandler(this.清空托盘信息ToolStripMenuItem_Click); this.清空托盘信息ToolStripMenuItem.Click += new System.EventHandler(this.清空托盘信息ToolStripMenuItem_Click);
// //
...@@ -998,11 +1017,6 @@ ...@@ -998,11 +1017,6 @@
this.新托盘检测逻辑ToolStripMenuItem.Text = "✔新托盘检测逻辑"; this.新托盘检测逻辑ToolStripMenuItem.Text = "✔新托盘检测逻辑";
this.新托盘检测逻辑ToolStripMenuItem.Click += new System.EventHandler(this.新托盘检测逻辑ToolStripMenuItem_Click); this.新托盘检测逻辑ToolStripMenuItem.Click += new System.EventHandler(this.新托盘检测逻辑ToolStripMenuItem_Click);
// //
// toolStripSeparator20
//
this.toolStripSeparator20.Name = "toolStripSeparator20";
this.toolStripSeparator20.Size = new System.Drawing.Size(177, 6);
//
// FrmLineStore // FrmLineStore
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
...@@ -1138,6 +1152,7 @@ ...@@ -1138,6 +1152,7 @@
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator13; private System.Windows.Forms.ToolStripSeparator toolStripSeparator13;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator20; private System.Windows.Forms.ToolStripSeparator toolStripSeparator20;
private System.Windows.Forms.CheckBox checkBox1;
} }
} }
...@@ -152,6 +152,7 @@ namespace OnlineStore.AssemblyLine ...@@ -152,6 +152,7 @@ namespace OnlineStore.AssemblyLine
{ {
自动保存托盘信息ToolStripMenuItem.Text = gouStr + "自动保存托盘信息"; 自动保存托盘信息ToolStripMenuItem.Text = gouStr + "自动保存托盘信息";
} }
checkBox1.Checked = CodeManager.SaveReelCheckImage;
cmbTrayType.SelectedIndex = 0; cmbTrayType.SelectedIndex = 0;
cmbTray.SelectedIndex = 0; cmbTray.SelectedIndex = 0;
LogUtil.logBox = this.logBox; LogUtil.logBox = this.logBox;
...@@ -1468,5 +1469,19 @@ namespace OnlineStore.AssemblyLine ...@@ -1468,5 +1469,19 @@ namespace OnlineStore.AssemblyLine
FrmExceptionMsg frm = new FrmExceptionMsg(); FrmExceptionMsg frm = new FrmExceptionMsg();
frm.ShowDialog(); frm.ShowDialog();
} }
private void checkBox1_CheckedChanged_1(object sender, EventArgs e)
{
if (!LoadOk)
{
return;
}
if (CodeManager.SaveReelCheckImage.Equals(checkBox1.Checked))
{
return;
}
CodeManager.SaveReelCheckImage = (checkBox1.Checked);
LogUtil.info("勾选 保存托盘验证图片功能:CodeManager.SaveReelCheckImage =" + CodeManager.SaveReelCheckImage);
}
} }
} }
...@@ -17,6 +17,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -17,6 +17,7 @@ namespace OnlineStore.DeviceLibrary
public class CodeManager public class CodeManager
{ {
public static bool SaveImage = false; public static bool SaveImage = false;
public static bool SaveReelCheckImage = true;
public static List<string> allCodeTypeList = new List<string>(); public static List<string> allCodeTypeList = new List<string>();
public static List<string> balserNameList = new List<string>(); public static List<string> balserNameList = new List<string>();
public static List<string> hikNameList = new List<string>(); public static List<string> hikNameList = new List<string>();
...@@ -397,7 +398,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -397,7 +398,7 @@ namespace OnlineStore.DeviceLibrary
if (needSaveImg) if (needSaveImg)
{ {
string nameStr = "nofindCode"; string nameStr = "nofindCode";
SaveImageToFile(deviceName, cameraName + nameStr, bmp); SaveNoReelImageToFile(deviceName, cameraName + nameStr, bmp);
} }
if (deviceName != "" || r != "") if (deviceName != "" || r != "")
...@@ -463,10 +464,20 @@ namespace OnlineStore.DeviceLibrary ...@@ -463,10 +464,20 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error("保存" + deviceName + " 【" + cameraName + "】的图片到【" + dire + iamgeName + "】出错" + ex.ToString()); LogUtil.error("保存" + deviceName + " 【" + cameraName + "】的图片到【" + dire + iamgeName + "】出错" + ex.ToString());
} }
} }
private static void SaveNoReelImageToFile(string deviceName, string cameraName, Bitmap bitmap)
{
if (!SaveReelCheckImage) return;
saveImg(deviceName, cameraName, bitmap);
}
private static void SaveImageToFile(string deviceName, string cameraName, Bitmap bitmap) private static void SaveImageToFile(string deviceName, string cameraName, Bitmap bitmap)
{ {
if (!SaveImage) return; if (!SaveImage) return;
string date = deviceName.Trim().Replace('_', '-') +"-"+ DateTime.Now.ToString("yyyyMMdd-HHmmss") + DateTime.Now.Millisecond; saveImg(deviceName, cameraName, bitmap);
}
private static void saveImg(string deviceName, string cameraName, Bitmap bitmap)
{
string date = deviceName.Trim().Replace('_', '-') + "-" + DateTime.Now.ToString("yyyyMMdd-HHmmss") + DateTime.Now.Millisecond;
string dire = @"D:\image\" + deviceName.Trim().Replace('_', '-') + @"\" + cameraName.Trim().Replace('_', '-').Replace(':', '-') + @"\"; string dire = @"D:\image\" + deviceName.Trim().Replace('_', '-') + @"\" + cameraName.Trim().Replace('_', '-').Replace(':', '-') + @"\";
string iamgeName = date + ".bmp"; string iamgeName = date + ".bmp";
try try
...@@ -476,15 +487,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -476,15 +487,18 @@ namespace OnlineStore.DeviceLibrary
{ {
Directory.CreateDirectory(dire); Directory.CreateDirectory(dire);
} }
bit.Save(dire + iamgeName, ImageFormat.Bmp); if (ReelCheckUtil.canSavePic(dire))
LogUtil.info(deviceName + " 【" + cameraName + "】扫码失败,保存图片到【" + dire + iamgeName + "】成功"); {
bit.Save(dire + iamgeName, ImageFormat.Bmp);
LogUtil.info(deviceName + " 【" + cameraName + "】扫码失败,保存图片到【" + dire + iamgeName + "】成功");
}
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("保存" + deviceName + " 【" + cameraName + "】的图片到【" + dire + iamgeName + "】出错" + ex.ToString()); LogUtil.error("保存" + deviceName + " 【" + cameraName + "】的图片到【" + dire + iamgeName + "】出错" + ex.ToString());
} }
} }
public static bool HasRightCode(params string[] codes) public static bool HasRightCode(params string[] codes)
{ {
//分号分割后长度=4,L,E,B,R //分号分割后长度=4,L,E,B,R
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!