Commit 55ddf5ac 张东亮

合并

2 个父辈 501ae682 b46a1f1f
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
...@@ -130,6 +130,12 @@ ...@@ -130,6 +130,12 @@
<Compile Include="UC\ListEditControl.Designer.cs"> <Compile Include="UC\ListEditControl.Designer.cs">
<DependentUpon>ListEditControl.cs</DependentUpon> <DependentUpon>ListEditControl.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="UC_U1.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UC_U1.Designer.cs">
<DependentUpon>UC_U1.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="AboutBox1.resx"> <EmbeddedResource Include="AboutBox1.resx">
<DependentUpon>AboutBox1.cs</DependentUpon> <DependentUpon>AboutBox1.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
...@@ -168,6 +174,9 @@ ...@@ -168,6 +174,9 @@
<EmbeddedResource Include="UC\ListEditControl.resx"> <EmbeddedResource Include="UC\ListEditControl.resx">
<DependentUpon>ListEditControl.cs</DependentUpon> <DependentUpon>ListEditControl.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="UC_U1.resx">
<DependentUpon>UC_U1.cs</DependentUpon>
</EmbeddedResource>
<None Include="app.manifest" /> <None Include="app.manifest" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
...@@ -185,6 +194,7 @@ ...@@ -185,6 +194,7 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="resources\So1164自动扫码贴标机.xlsx" /> <None Include="resources\So1164自动扫码贴标机.xlsx" />
<None Include="resources\So1164自动扫码贴标机2.xlsx" />
<None Include="resources\zh-CN.lngres"> <None Include="resources\zh-CN.lngres">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
...@@ -214,4 +224,7 @@ ...@@ -214,4 +224,7 @@
<Content Include="icon.ico" /> <Content Include="icon.ico" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>start $(TargetDir)</PostBuildEvent>
</PropertyGroup>
</Project> </Project>
\ No newline at end of file \ No newline at end of file
...@@ -66,7 +66,7 @@ namespace AutoScanAndLabel ...@@ -66,7 +66,7 @@ namespace AutoScanAndLabel
stateView.Columns[2].Text = crc.GetString("Res0006","步骤"); stateView.Columns[2].Text = crc.GetString("Res0006","步骤");
stateView.Columns[3].Text = crc.GetString("Form1_tabControl1_tabPage1_Text","信息"); stateView.Columns[3].Text = crc.GetString("Form1_tabControl1_tabPage1_Text","信息");
启用调试模式ToolStripMenuItem.Text = !RobotManage.IsDebug ? crc.GetString(crc.GetString("Res0101","设备操作ToolStripMenuItem_启用调试模式ToolStripMenuItem_Text"),"启用配置模式") : crc.GetString("Res0012","停用配置模式"); 启用调试模式ToolStripMenuItem.Text = !RobotManage.IsDebug ? crc.GetString("Res0101", "启用配置模式") : crc.GetString("Res0012", "停用配置模式");
btn_run.Text = crc.GetString("Form1_btn_run_Text","启动"); btn_run.Text = crc.GetString("Form1_btn_run_Text","启动");
...@@ -229,7 +229,7 @@ namespace AutoScanAndLabel ...@@ -229,7 +229,7 @@ namespace AutoScanAndLabel
{ {
RobotManage.IsDebug = RobotManage.IsDebug ? false : true; RobotManage.IsDebug = RobotManage.IsDebug ? false : true;
(sender as ToolStripMenuItem).Text = !RobotManage.IsDebug ? crc.GetString(crc.GetString("Res0101","设备操作ToolStripMenuItem_启用调试模式ToolStripMenuItem_Text"),"启用配置模式") : crc.GetString("Res0012","停用配置模式"); (sender as ToolStripMenuItem).Text = !RobotManage.IsDebug ? crc.GetString("Res0101", "设备操作") : crc.GetString("Res0012", "停用配置模式");
//RobotManage.Init(); //RobotManage.Init();
......
...@@ -45,6 +45,8 @@ namespace AutoScanAndLabel ...@@ -45,6 +45,8 @@ namespace AutoScanAndLabel
this.btn_codetest = new System.Windows.Forms.Button(); this.btn_codetest = new System.Windows.Forms.Button();
this.label_matchdebugstring = new System.Windows.Forms.Label(); this.label_matchdebugstring = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox(); this.groupBox4 = new System.Windows.Forms.GroupBox();
this.button1 = new System.Windows.Forms.Button();
this.uC_U11 = new AutoScanAndLabel.UC_U1();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
...@@ -98,7 +100,7 @@ namespace AutoScanAndLabel ...@@ -98,7 +100,7 @@ namespace AutoScanAndLabel
this.cb_labelselect.FormattingEnabled = true; this.cb_labelselect.FormattingEnabled = true;
this.cb_labelselect.Location = new System.Drawing.Point(134, 75); this.cb_labelselect.Location = new System.Drawing.Point(134, 75);
this.cb_labelselect.Name = "cb_labelselect"; this.cb_labelselect.Name = "cb_labelselect";
this.cb_labelselect.Size = new System.Drawing.Size(198, 23); this.cb_labelselect.Size = new System.Drawing.Size(198, 20);
this.cb_labelselect.TabIndex = 0; this.cb_labelselect.TabIndex = 0;
this.cb_labelselect.SelectedIndexChanged += new System.EventHandler(this.cb_labelselect_SelectedIndexChanged); this.cb_labelselect.SelectedIndexChanged += new System.EventHandler(this.cb_labelselect_SelectedIndexChanged);
// //
...@@ -107,7 +109,7 @@ namespace AutoScanAndLabel ...@@ -107,7 +109,7 @@ namespace AutoScanAndLabel
this.cb_printerselect.FormattingEnabled = true; this.cb_printerselect.FormattingEnabled = true;
this.cb_printerselect.Location = new System.Drawing.Point(134, 37); this.cb_printerselect.Location = new System.Drawing.Point(134, 37);
this.cb_printerselect.Name = "cb_printerselect"; this.cb_printerselect.Name = "cb_printerselect";
this.cb_printerselect.Size = new System.Drawing.Size(198, 23); this.cb_printerselect.Size = new System.Drawing.Size(198, 20);
this.cb_printerselect.TabIndex = 0; this.cb_printerselect.TabIndex = 0;
this.cb_printerselect.SelectedIndexChanged += new System.EventHandler(this.cb_printerselect_SelectedIndexChanged); this.cb_printerselect.SelectedIndexChanged += new System.EventHandler(this.cb_printerselect_SelectedIndexChanged);
// //
...@@ -116,14 +118,14 @@ namespace AutoScanAndLabel ...@@ -116,14 +118,14 @@ namespace AutoScanAndLabel
this.chbAutoRun.AutoSize = true; this.chbAutoRun.AutoSize = true;
this.chbAutoRun.Location = new System.Drawing.Point(3, 185); this.chbAutoRun.Location = new System.Drawing.Point(3, 185);
this.chbAutoRun.Name = "chbAutoRun"; this.chbAutoRun.Name = "chbAutoRun";
this.chbAutoRun.Size = new System.Drawing.Size(104, 19); this.chbAutoRun.Size = new System.Drawing.Size(84, 16);
this.chbAutoRun.TabIndex = 1; this.chbAutoRun.TabIndex = 1;
this.chbAutoRun.Text = "开机自启动"; this.chbAutoRun.Text = "开机自启动";
this.chbAutoRun.UseVisualStyleBackColor = true; this.chbAutoRun.UseVisualStyleBackColor = true;
// //
// btn_labelDebug // btn_labelDebug
// //
this.btn_labelDebug.Location = new System.Drawing.Point(182, 178); this.btn_labelDebug.Location = new System.Drawing.Point(154, 551);
this.btn_labelDebug.Name = "btn_labelDebug"; this.btn_labelDebug.Name = "btn_labelDebug";
this.btn_labelDebug.Size = new System.Drawing.Size(140, 28); this.btn_labelDebug.Size = new System.Drawing.Size(140, 28);
this.btn_labelDebug.TabIndex = 2; this.btn_labelDebug.TabIndex = 2;
...@@ -135,7 +137,7 @@ namespace AutoScanAndLabel ...@@ -135,7 +137,7 @@ namespace AutoScanAndLabel
// groupBox2 // groupBox2
// //
this.groupBox2.Controls.Add(this.listEdit_pn); this.groupBox2.Controls.Add(this.listEdit_pn);
this.groupBox2.Location = new System.Drawing.Point(403, 0); this.groupBox2.Location = new System.Drawing.Point(617, 23);
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(360, 178); this.groupBox2.Size = new System.Drawing.Size(360, 178);
this.groupBox2.TabIndex = 4; this.groupBox2.TabIndex = 4;
...@@ -148,17 +150,17 @@ namespace AutoScanAndLabel ...@@ -148,17 +150,17 @@ namespace AutoScanAndLabel
this.listEdit_pn.Dock = System.Windows.Forms.DockStyle.Fill; this.listEdit_pn.Dock = System.Windows.Forms.DockStyle.Fill;
this.listEdit_pn.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.listEdit_pn.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.listEdit_pn.ListFile = "config/pn.list"; this.listEdit_pn.ListFile = "config/pn.list";
this.listEdit_pn.Location = new System.Drawing.Point(3, 21); this.listEdit_pn.Location = new System.Drawing.Point(3, 17);
this.listEdit_pn.Margin = new System.Windows.Forms.Padding(5); this.listEdit_pn.Margin = new System.Windows.Forms.Padding(5);
this.listEdit_pn.Name = "listEdit_pn"; this.listEdit_pn.Name = "listEdit_pn";
this.listEdit_pn.Size = new System.Drawing.Size(354, 154); this.listEdit_pn.Size = new System.Drawing.Size(354, 158);
this.listEdit_pn.TabIndex = 3; this.listEdit_pn.TabIndex = 3;
this.listEdit_pn.DataRefresh += new System.EventHandler(this.listEdit_pn_DataRefresh); this.listEdit_pn.DataRefresh += new System.EventHandler(this.listEdit_pn_DataRefresh);
// //
// groupBox3 // groupBox3
// //
this.groupBox3.Controls.Add(this.listEditControl1); this.groupBox3.Controls.Add(this.listEditControl1);
this.groupBox3.Location = new System.Drawing.Point(403, 185); this.groupBox3.Location = new System.Drawing.Point(617, 208);
this.groupBox3.Name = "groupBox3"; this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(360, 228); this.groupBox3.Size = new System.Drawing.Size(360, 228);
this.groupBox3.TabIndex = 4; this.groupBox3.TabIndex = 4;
...@@ -171,10 +173,10 @@ namespace AutoScanAndLabel ...@@ -171,10 +173,10 @@ namespace AutoScanAndLabel
this.listEditControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.listEditControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.listEditControl1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.listEditControl1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.listEditControl1.ListFile = "config/qty.list"; this.listEditControl1.ListFile = "config/qty.list";
this.listEditControl1.Location = new System.Drawing.Point(3, 21); this.listEditControl1.Location = new System.Drawing.Point(3, 17);
this.listEditControl1.Margin = new System.Windows.Forms.Padding(5); this.listEditControl1.Margin = new System.Windows.Forms.Padding(5);
this.listEditControl1.Name = "listEditControl1"; this.listEditControl1.Name = "listEditControl1";
this.listEditControl1.Size = new System.Drawing.Size(354, 204); this.listEditControl1.Size = new System.Drawing.Size(354, 208);
this.listEditControl1.TabIndex = 3; this.listEditControl1.TabIndex = 3;
this.listEditControl1.DataRefresh += new System.EventHandler(this.listEdit_pn_DataRefresh); this.listEditControl1.DataRefresh += new System.EventHandler(this.listEdit_pn_DataRefresh);
// //
...@@ -182,7 +184,7 @@ namespace AutoScanAndLabel ...@@ -182,7 +184,7 @@ namespace AutoScanAndLabel
// //
this.txt_code.Location = new System.Drawing.Point(6, 24); this.txt_code.Location = new System.Drawing.Point(6, 24);
this.txt_code.Name = "txt_code"; this.txt_code.Name = "txt_code";
this.txt_code.Size = new System.Drawing.Size(264, 25); this.txt_code.Size = new System.Drawing.Size(264, 21);
this.txt_code.TabIndex = 5; this.txt_code.TabIndex = 5;
// //
// btn_codetest // btn_codetest
...@@ -207,7 +209,7 @@ namespace AutoScanAndLabel ...@@ -207,7 +209,7 @@ namespace AutoScanAndLabel
this.groupBox4.Controls.Add(this.txt_code); this.groupBox4.Controls.Add(this.txt_code);
this.groupBox4.Controls.Add(this.label_matchdebugstring); this.groupBox4.Controls.Add(this.label_matchdebugstring);
this.groupBox4.Controls.Add(this.btn_codetest); this.groupBox4.Controls.Add(this.btn_codetest);
this.groupBox4.Location = new System.Drawing.Point(406, 419); this.groupBox4.Location = new System.Drawing.Point(620, 442);
this.groupBox4.Name = "groupBox4"; this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(357, 191); this.groupBox4.Size = new System.Drawing.Size(357, 191);
this.groupBox4.TabIndex = 8; this.groupBox4.TabIndex = 8;
...@@ -215,9 +217,28 @@ namespace AutoScanAndLabel ...@@ -215,9 +217,28 @@ namespace AutoScanAndLabel
this.groupBox4.Text = "条码匹配测试"; this.groupBox4.Text = "条码匹配测试";
this.groupBox4.Visible = false; this.groupBox4.Visible = false;
// //
// button1
//
this.button1.Location = new System.Drawing.Point(41, 556);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 10;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// uC_U11
//
this.uC_U11.Location = new System.Drawing.Point(3, 246);
this.uC_U11.Name = "uC_U11";
this.uC_U11.Size = new System.Drawing.Size(383, 167);
this.uC_U11.TabIndex = 9;
//
// SettingControl // SettingControl
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.button1);
this.Controls.Add(this.uC_U11);
this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox2);
...@@ -255,5 +276,7 @@ namespace AutoScanAndLabel ...@@ -255,5 +276,7 @@ namespace AutoScanAndLabel
private System.Windows.Forms.Button btn_codetest; private System.Windows.Forms.Button btn_codetest;
private System.Windows.Forms.Label label_matchdebugstring; private System.Windows.Forms.Label label_matchdebugstring;
private System.Windows.Forms.GroupBox groupBox4; private System.Windows.Forms.GroupBox groupBox4;
private UC_U1 uC_U11;
private System.Windows.Forms.Button button1;
} }
} }
using CodeLibrary; using CodeLibrary;
using ConfigHelper; using ConfigHelper;
using DeviceLibrary; using DeviceLibrary;
using OnlineStore;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
...@@ -8,6 +9,7 @@ using System.Collections.Generic; ...@@ -8,6 +9,7 @@ using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
...@@ -73,7 +75,14 @@ namespace AutoScanAndLabel ...@@ -73,7 +75,14 @@ namespace AutoScanAndLabel
private void btn_labeledit_Click(object sender, EventArgs e) private void btn_labeledit_Click(object sender, EventArgs e)
{ {
RobotManage.PrintBean.EditLabel(); var keys = File.ReadAllLines("NeoScan\\config\\MacroKey.txt");
//RobotManage.PrintBean.EditLabel();
PrintLabel.FrmLabel frmLabel = new PrintLabel.FrmLabel();
//crc.CurrLanguage = "";
crc.LanguageProcess(frmLabel, "FrmLabel");
frmLabel.KeyWord.AddRange(keys);
frmLabel.ShowDialog();
RobotManage_LoadFinishEvent(true, ""); RobotManage_LoadFinishEvent(true, "");
RobotManage.LoadPrintSetting(); RobotManage.LoadPrintSetting();
} }
...@@ -153,5 +162,12 @@ namespace AutoScanAndLabel ...@@ -153,5 +162,12 @@ namespace AutoScanAndLabel
Common.codeProcess(labelParam, out string debugstring); Common.codeProcess(labelParam, out string debugstring);
label_matchdebugstring.Text = debugstring; label_matchdebugstring.Text = debugstring;
} }
private void button1_Click(object sender, EventArgs e)
{
RemoteDecodeHelper_mod.RemoteDecodeParam remoteDecodeParam = new RemoteDecodeHelper_mod.RemoteDecodeParam();
var bmp = new Bitmap("d:\\17-09-05-154.bmp");
var cc = RemoteDecodeHelper_mod.DecodeRequest(bmp, remoteDecodeParam);
}
} }
} }
...@@ -81,6 +81,9 @@ namespace AutoScanAndLabel.UC ...@@ -81,6 +81,9 @@ namespace AutoScanAndLabel.UC
private void ListEditControl_Load(object sender, EventArgs e) private void ListEditControl_Load(object sender, EventArgs e)
{ {
if (DesignMode)
return;
if (!File.Exists(listfile)) if (!File.Exists(listfile))
return; return;
stringlist.AddRange(File.ReadAllLines(listfile).ToList().FindAll((s)=> { return !string.IsNullOrWhiteSpace(s); }).ToArray()); stringlist.AddRange(File.ReadAllLines(listfile).ToList().FindAll((s)=> { return !string.IsNullOrWhiteSpace(s); }).ToArray());
......

namespace AutoScanAndLabel
{
partial class UC_U1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label_dir = new System.Windows.Forms.Label();
this.btn_selectdir = new System.Windows.Forms.Button();
this.txt_reelphotodir = new System.Windows.Forms.TextBox();
this.cb_exportreephoto = new System.Windows.Forms.CheckBox();
this.gb = new System.Windows.Forms.GroupBox();
this.gb.SuspendLayout();
this.SuspendLayout();
//
// label_dir
//
this.label_dir.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label_dir.AutoSize = true;
this.label_dir.Location = new System.Drawing.Point(3, 53);
this.label_dir.Name = "label_dir";
this.label_dir.Size = new System.Drawing.Size(83, 12);
this.label_dir.TabIndex = 16;
this.label_dir.Text = "图像保存目录:";
//
// btn_selectdir
//
this.btn_selectdir.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btn_selectdir.Location = new System.Drawing.Point(355, 71);
this.btn_selectdir.Name = "btn_selectdir";
this.btn_selectdir.Size = new System.Drawing.Size(65, 23);
this.btn_selectdir.TabIndex = 15;
this.btn_selectdir.Text = "浏览";
this.btn_selectdir.UseVisualStyleBackColor = true;
this.btn_selectdir.Click += new System.EventHandler(this.btn_selectdir_Click);
//
// txt_reelphotodir
//
this.txt_reelphotodir.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txt_reelphotodir.Location = new System.Drawing.Point(3, 74);
this.txt_reelphotodir.Name = "txt_reelphotodir";
this.txt_reelphotodir.ReadOnly = true;
this.txt_reelphotodir.Size = new System.Drawing.Size(346, 21);
this.txt_reelphotodir.TabIndex = 14;
//
// cb_exportreephoto
//
this.cb_exportreephoto.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.cb_exportreephoto.AutoSize = true;
this.cb_exportreephoto.Location = new System.Drawing.Point(6, 20);
this.cb_exportreephoto.Name = "cb_exportreephoto";
this.cb_exportreephoto.Size = new System.Drawing.Size(264, 16);
this.cb_exportreephoto.TabIndex = 13;
this.cb_exportreephoto.Text = "自动拍摄并保存料盘图像. 勾选后仅本次有效";
this.cb_exportreephoto.UseVisualStyleBackColor = true;
//
// gb
//
this.gb.Controls.Add(this.cb_exportreephoto);
this.gb.Controls.Add(this.btn_selectdir);
this.gb.Controls.Add(this.label_dir);
this.gb.Controls.Add(this.txt_reelphotodir);
this.gb.Dock = System.Windows.Forms.DockStyle.Fill;
this.gb.Location = new System.Drawing.Point(0, 0);
this.gb.Name = "gb";
this.gb.Size = new System.Drawing.Size(431, 148);
this.gb.TabIndex = 17;
this.gb.TabStop = false;
this.gb.Text = "料盘图像导出";
//
// UC_U1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.gb);
this.Name = "UC_U1";
this.Size = new System.Drawing.Size(431, 148);
this.Load += new System.EventHandler(this.UC_U1_Load);
this.gb.ResumeLayout(false);
this.gb.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label label_dir;
private System.Windows.Forms.Button btn_selectdir;
private System.Windows.Forms.TextBox txt_reelphotodir;
private System.Windows.Forms.CheckBox cb_exportreephoto;
private System.Windows.Forms.GroupBox gb;
}
}
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AutoScanAndLabel
{
public partial class UC_U1 : UserControl
{
public UC_U1()
{
InitializeComponent();
}
private void btn_selectdir_Click(object sender, EventArgs e)
{
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
folderBrowserDialog.ShowNewFolderButton = true;
if (folderBrowserDialog.ShowDialog() == DialogResult.OK) {
txt_reelphotodir.Text = folderBrowserDialog.SelectedPath;
}
}
private void UC_U1_Load(object sender, EventArgs e)
{
ConfigHelper.Config.PropertyBind(Setting_Init.ReelPhotoSaveDir, txt_reelphotodir, "Text", "TextChanged");
ConfigHelper.Config.PropertyBind(Setting_Init.SaveReelPhoto, cb_exportreephoto, "Checked", "CheckedChanged");
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file \ No newline at end of file
...@@ -158,6 +158,10 @@ Form1_tabControl1_Res0010__SettingControl_groupBox3_listEditControl1_btn_del_Tex ...@@ -158,6 +158,10 @@ Form1_tabControl1_Res0010__SettingControl_groupBox3_listEditControl1_btn_del_Tex
Form1_tabControl1_Res0010__SettingControl_groupBox3_Text QTY匹配规则 QTYマッチングルール Form1_tabControl1_Res0010__SettingControl_groupBox3_Text QTY匹配规则 QTYマッチングルール
Form1_tabControl1_Res0010__SettingControl_groupBox4_btn_codetest_Text 匹配 マッチング Form1_tabControl1_Res0010__SettingControl_groupBox4_btn_codetest_Text 匹配 マッチング
Form1_tabControl1_Res0010__SettingControl_groupBox4_Text 条码匹配测试 バーコードマッチングテスト Form1_tabControl1_Res0010__SettingControl_groupBox4_Text 条码匹配测试 バーコードマッチングテスト
Form1_tabControl1_Res0010__SettingControl_uC_U11_gb_btn_selectdir_Text 浏览 開く
Form1_tabControl1_Res0010__SettingControl_uC_U11_gb_cb_exportreephoto_Text 自动拍摄并保存料盘图像. 勾选后仅本次有效 リール画像自動撮影・保存(今回のみ有効)
Form1_tabControl1_Res0010__SettingControl_uC_U11_gb_label_dir_Text 图像保存目录: 画像保存フォルダー
Form1_tabControl1_Res0010__SettingControl_uC_U11_gb_Text 料盘图像导出 リール画像輸出
Form1_tabControl1_Res0070__AgvControl_checkBox1_Text 手动 手動 Form1_tabControl1_Res0070__AgvControl_checkBox1_Text 手动 手動
Form1_tabControl1_Res0070__AgvControl_groupBox_left_button_Leftleavefull_Text 满料串取出 満載リール運搬ユニット取り出し Form1_tabControl1_Res0070__AgvControl_groupBox_left_button_Leftleavefull_Text 满料串取出 満載リール運搬ユニット取り出し
Form1_tabControl1_Res0070__AgvControl_groupBox_left_button_leftneedempty_Text 空料串送入 空きリール運搬ユニット投入 Form1_tabControl1_Res0070__AgvControl_groupBox_left_button_leftneedempty_Text 空料串送入 空きリール運搬ユニット投入
...@@ -189,6 +193,15 @@ Form1_tabControl1_tabPage1_cb_IgnoreGratingSignal_Text 蠢ス逡・螳牙蜈画 繝ゥ繧、 ...@@ -189,6 +193,15 @@ Form1_tabControl1_tabPage1_cb_IgnoreGratingSignal_Text 蠢ス逡・螳牙蜈画 繝ゥ繧、
Form1_tabControl1_tabPage1_cb_IgnoreSafecheck_Text 忽略安全检查(含安全光栅) セーフティチックを無視する(ライトカーテン含み) Form1_tabControl1_tabPage1_cb_IgnoreSafecheck_Text 忽略安全检查(含安全光栅) セーフティチックを無視する(ライトカーテン含み)
Form1_tabControl1_tabPage1_groupBox1_Text 运行状态 実行状況 Form1_tabControl1_tabPage1_groupBox1_Text 运行状态 実行状況
Form1_tabControl1_tabPage1_Text 信息 情報 Form1_tabControl1_tabPage1_Text 信息 情報
FrmLabel_BtnFieldAdd_Text 字段添加 フィールド追加
FrmLabel_BtnFieldDel_Text 字段删除 フィールド削除
FrmLabel_BtnFieldFont_Text 字段字体 フィールド字体
FrmLabel_BtnLabelDel_Text 删除 削減
FrmLabel_BtnLabelNew_Text 新建 新規
FrmLabel_BtnPrintTest_Text 打印测试 印刷テスト
FrmLabel_BtnRename_Text 新建 新規
FrmLabel_BtnSave_Text 保存 保存
FrmLabel_groupBox1_Text 字段说明 フィールド説明
menuStrip1_关于ToolStripMenuItem_Text 关于 情報 menuStrip1_关于ToolStripMenuItem_Text 关于 情報
menuStrip1_设备操作ToolStripMenuItem_Text 设备操作 操作 menuStrip1_设备操作ToolStripMenuItem_Text 设备操作 操作
menuStrip1_语言toolStripMenuItem_Text 语言 言語 menuStrip1_语言toolStripMenuItem_Text 语言 言語
...@@ -202,12 +215,6 @@ AutoRun_HddLed 閾ェ蜉ィ謖、コ轣ッ 閾ェ蜍戊。ィ遉コ轣ッ ...@@ -202,12 +215,6 @@ AutoRun_HddLed 閾ェ蜉ィ謖、コ轣ッ 閾ェ蜍戊。ィ遉コ轣ッ
Cam_Pixel_X_Ratio 图像/X轴比值 イメージ/X軸比率 Cam_Pixel_X_Ratio 图像/X轴比值 イメージ/X軸比率
Cam_Pixel_Y_Ratio 图像/Y轴比值 イメージ/Y軸比率 Cam_Pixel_Y_Ratio 图像/Y轴比值 イメージ/Y軸比率
Camera_Led 相机照明 カメラ照明 Camera_Led 相机照明 カメラ照明
crc.GetString("Res0101 设备操作ToolStripMenuItem_启用调试模式ToolStripMenuItem_Text
crc.GetString("Res0101","设备操作ToolStripMenuItem_启用调试模式ToolStripMenuItem_Text") 启用配置模式 設定モードを開ける
crc.GetString("Res0102 Form1_tabControl1___IOControl_groupBox1_btn夹爪夹紧_Text
crc.GetString("Res0102","Form1_tabControl1___IOControl_groupBox1_btn夹爪夹紧_Text") 夹爪夹紧 グリッパー圧着
crc.GetString("Res0103 Form1_tabControl1___IOControl_groupBox1_btn夹爪放松_Text
crc.GetString("Res0103","Form1_tabControl1___IOControl_groupBox1_btn夹爪放松_Text") 夹爪放松 グリッパー解除
Device_Led 设备照明 設備証明 Device_Led 设备照明 設備証明
GratingSignal_Check 光栅信号 ライトカーテン信号 GratingSignal_Check 光栅信号 ライトカーテン信号
HasNgBox NG料箱检测 NG箱検知 HasNgBox NG料箱检测 NG箱検知
...@@ -318,7 +325,7 @@ Res0029 轤ケ菴榊陦ィ 轤ケ菴阪Μ繧ケ繝 ...@@ -318,7 +325,7 @@ Res0029 轤ケ菴榊陦ィ 轤ケ菴阪Μ繧ケ繝
Res0030 全部保存 すべて保存 Res0030 全部保存 すべて保存
Res0031 添加 追加 Res0031 添加 追加
Res0032 修改 修正 Res0032 修改 修正
Res0033 "确定要删除:\""{0}\""?" "削除しますか:\""{0}\""?" Res0033 确定要删除:\"{0}\"? 削除しますか:\"{0}\"?
Res0034 警告 注意 Res0034 警告 注意
Res0035 已呼叫Agv,不能重复呼叫 AGVコール中 Res0035 已呼叫Agv,不能重复呼叫 AGVコール中
Res0036 移载 リール転移 Res0036 移载 リール転移
...@@ -334,9 +341,9 @@ Res0045 蠖灘燕ReelID: 迴セ蝨ィ縺ョReelID ...@@ -334,9 +341,9 @@ Res0045 蠖灘燕ReelID: 迴セ蝨ィ縺ョReelID
Res0046 无料串 リール運搬ユニット無し Res0046 无料串 リール運搬ユニット無し
Res0047 抓料失败请手动处理,请将料盘放入:NG箱,按入口按钮继续 リール掴み失敗。リールを:NG箱に投入し、「続き」ボダンを押してください。 Res0047 抓料失败请手动处理,请将料盘放入:NG箱,按入口按钮继续 リール掴み失敗。リールを:NG箱に投入し、「続き」ボダンを押してください。
Res0048 抓料失败请手动处理,请将料盘放入: 出口料串,按入口按钮继续 リール掴み失敗。リールを:出口リール運搬ユニットに投入し、「続き」ボダンを押してください。 Res0048 抓料失败请手动处理,请将料盘放入: 出口料串,按入口按钮继续 リール掴み失敗。リールを:出口リール運搬ユニットに投入し、「続き」ボダンを押してください。
Res0049 等待出口允许放料 出口の材料追加許可待ち Res0049 等待出口允许放料 出口の材料追加許可待ち中
Res0050 等待夹爪放松 グリッパー解除待ち Res0050 等待夹爪放松 グリッパー解除待ち中
Res0051 出口放料 出口からリールを取る Res0051 出口放料 出口リール追加
Res0052 贴标 貼付 Res0052 贴标 貼付
Res0053 重置 リセット Res0053 重置 リセット
Res0054 可能与贴标Y轴干涉 ラベル貼付Y軸と干渉可能 Res0054 可能与贴标Y轴干涉 ラベル貼付Y軸と干渉可能
...@@ -358,7 +365,7 @@ Res0069 譛画侭荳イ,蟾イ謾セ鄂ョ{0}蠑譁咏尨 繝ェ繝シ繝ォ謳ャ騾√Θ繝九ャ繝医↓{0}譫壹Μ ...@@ -358,7 +365,7 @@ Res0069 譛画侭荳イ,蟾イ謾セ鄂ョ{0}蠑譁咏尨 繝ェ繝シ繝ォ謳ャ騾√Θ繝九ャ繝医↓{0}譫壹Μ
Res0070 Agv调试 AGV デバッグ Res0070 Agv调试 AGV デバッグ
Res0071 任务状态 任務状態 Res0071 任务状态 任務状態
Res0072 标签已打印,当前ReelID: ラベル印刷完了。現在のリールID: Res0072 标签已打印,当前ReelID: ラベル印刷完了。現在のリールID:
Res0073 等待标签打印 ラベル印刷待ち Res0073 等待标签打印 ラベル印刷待ち中
Res0074 等待中 待機中 Res0074 等待中 待機中
Res0075 任务编号: 任務番号: Res0075 任务编号: 任務番号:
Res0076 运行编号: 実行番号: Res0076 运行编号: 実行番号:
...@@ -368,27 +375,27 @@ Res0079 譛コ蝎ィ蟆壽悴蜷ッ蜉ィ荳崎蜻シ蜿ォAgv 險ュ蛯吶r襍キ蜍輔@縺溘→AGV 繧偵さ繝シ ...@@ -368,27 +375,27 @@ Res0079 譛コ蝎ィ蟆壽悴蜷ッ蜉ィ荳崎蜻シ蜿ォAgv 險ュ蛯吶r襍キ蜍輔@縺溘→AGV 繧偵さ繝シ
Res0080 当前有料串不能请求进入料串 リール運搬ユニットがある場合に、AGVをコールすることができません。 Res0080 当前有料串不能请求进入料串 リール運搬ユニットがある場合に、AGVをコールすることができません。
Res0081 当前没有料串不能请求取料串 リール運搬ユニットがない場合に、AGVをコールすることができません。 Res0081 当前没有料串不能请求取料串 リール運搬ユニットがない場合に、AGVをコールすることができません。
Res0082 机器尚在运行,不能退出,请先停止运行. 現行作業を停止して下さい。 Res0082 机器尚在运行,不能退出,请先停止运行. 現行作業を停止して下さい。
Res0083 左侧料串正在提升或下降, 不能释放 Res0083 左侧料串正在提升或下降, 不能释放 左リール運搬ユニットは上昇・下降は完了したと解除してください。
Res0084 左侧料串等待释放中({0}) Res0084 左侧料串等待释放中({0}) 左リール運搬ユニットは解除待ち中
Res0085 安全释放左侧料串 Res0085 安全释放左侧料串 左リール運搬ユニットは解除が完了しました。
Res0086 右侧料串当前没有就位, 不能释放 Res0086 右侧料串当前没有就位, 不能释放 右リール運搬ユニットは準備できたと解除してください。
Res0087 右侧料串等待释放中({0}) Res0087 右侧料串等待释放中({0}) 右リール運搬ユニットは解除待ち中
Res0088 安全释放右侧料串 Res0088 安全释放右侧料串 右リール運搬ユニットは解除が完了しました。
Res0089 右侧料串正在运行,不能手动上料 Res0089 右侧料串正在运行,不能手动上料 右リール運搬ユニットは作業完了したと手動で入庫してください。
Res0090 左侧料串正在运行,不能手动上料 Res0090 左侧料串正在运行,不能手动上料 左リール運搬ユニットは作業完了したと手動で入庫してください。
Res0091 请确认是否运动到该位置 Res0091 请确认是否运动到该位置 この位置に移動しますか?
Res0092 确定要删除:\"{0}\"? Res0092 确定要删除:\"{0}\"? 削除しますか?
Res0093 右侧料串已空,等待取走料串 Res0093 右侧料串已空,等待取走料串 右の空きリール運搬ユニットを取ってください。
Res0094 左侧料串已满,等待取走料串 Res0094 左侧料串已满,等待取走料串 左の満載リール運搬ユニットを取ってください。
Res0095 左侧空闲中 Res0095 左侧空闲中 左リール運搬ユニットが空いている状態です。
Res0096 抓料失败请手动处理,请将料盘放入:NG箱,按右侧按钮继续 Res0096 抓料失败请手动处理,请将料盘放入:NG箱,按右侧按钮继续 リール取り出し失敗。リールをNG箱に置いてください。右ボタンを押すと作業が続けます。
Res0097 抓料失败请手动处理,请将料盘放入: 左侧料串,按右侧按钮继续 Res0097 抓料失败请手动处理,请将料盘放入: 左侧料串,按右侧按钮继续 リール取り出し失敗。リールを左リール運搬ユニットに置いてください。右ボタンを押すと作業が続けます。
Res0098 等待左侧允许放料 Res0098 等待左侧允许放料 左側の材料追加許可待ち中
Res0099 等待料盘取走 Res0099 等待料盘取走 リールを取ってください。
Res0100 ,料串已清空. Res0100 ,料串已清空. リール運搬ユニットが空いている状態です。
Res0104 等待 待ち中 Res0104 等待 待ち中
Res0105 超时 タイムオーバー Res0105 超时 タイムオーバー
Res0106 秒 Res0106 秒
Res0188 电夹爪通讯失败:{0} グリッパー通信エラー Res0188 电夹爪通讯失败:{0} グリッパー通信エラー
Res0189 IO板卡初始化失败 IO初期化失敗 Res0189 IO板卡初始化失败 IO初期化失敗
Res0190 打开配置模式 設定モード起動 Res0190 打开配置模式 設定モード起動
...@@ -406,3 +413,6 @@ Res0202 莨コ譛榊ー壽悴菴ソ閭ス 繧オ繝シ繝懷●豁「荳ュ ...@@ -406,3 +413,6 @@ Res0202 莨コ譛榊ー壽悴菴ソ閭ス 繧オ繝シ繝懷●豁「荳ュ
Res0203 伺服警报状态中 サーボアラーム状態 Res0203 伺服警报状态中 サーボアラーム状態
Res0204 无法操作 動作不能 Res0204 无法操作 動作不能
Res0216 打印机 プリンター Res0216 打印机 プリンター
Res0101 启用配置模式 設定モードを開ける
Res0102 夹爪夹紧 グリッパー圧着
Res0103 夹爪放松 グリッパー解除
...@@ -6,6 +6,7 @@ using System.ComponentModel; ...@@ -6,6 +6,7 @@ using System.ComponentModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Forms.Layout; using System.Windows.Forms.Layout;
...@@ -176,6 +177,7 @@ namespace OnlineStore ...@@ -176,6 +177,7 @@ namespace OnlineStore
if ((strCurLanguage == null || strCurLanguage.Equals("")) && (!defaultStr.Equals(""))) if ((strCurLanguage == null || strCurLanguage.Equals("")) && (!defaultStr.Equals("")))
{ {
strCurLanguage = defaultStr; strCurLanguage = defaultStr;
if (HasChinese(defaultStr))
NoIdLog(id, defaultStr); NoIdLog(id, defaultStr);
} }
} }
...@@ -388,5 +390,15 @@ namespace OnlineStore ...@@ -388,5 +390,15 @@ namespace OnlineStore
//if (con is Form) methodname = "Title"; //if (con is Form) methodname = "Title";
return methodname; return methodname;
} }
static bool HasChinese(string txt)
{
//for (int i = 0; i < txt.Length; i++)
//{
if (Regex.IsMatch(txt.ToString(), @"[\u4E00-\u9FA5]+"))
return true;
//}
return false;
}
} }
} }
...@@ -46,6 +46,8 @@ namespace OnlineStore.Common ...@@ -46,6 +46,8 @@ namespace OnlineStore.Common
public static string StickingPosJudgment = "StickingPosJudgment"; public static string StickingPosJudgment = "StickingPosJudgment";
public static string GratingSignal = " GratingSignal"; public static string GratingSignal = " GratingSignal";
public static string SaveReelPhoto = "SaveReelPhoto";
public static string ReelPhotoSaveDir = "ReelPhotoSaveDir";
/// <summary> /// <summary>
/// 启用贴标功能 /// 启用贴标功能
/// </summary> /// </summary>
......
...@@ -141,7 +141,7 @@ namespace DeviceLibrary ...@@ -141,7 +141,7 @@ namespace DeviceLibrary
//var y = srcbitmap_Width - c.X; //var y = srcbitmap_Width - c.X;
//c.X = x; //c.X = x;
//c.Y = y; //c.Y = y;
if (c.CodeStr.Contains(labelParam.PN)) if (true)
{ {
Point op = new Point(c.X, c.Y); Point op = new Point(c.X, c.Y);
g.FillEllipse(blue, new Rectangle(op, pointsize)); g.FillEllipse(blue, new Rectangle(op, pointsize));
...@@ -214,6 +214,8 @@ namespace DeviceLibrary ...@@ -214,6 +214,8 @@ namespace DeviceLibrary
qtyreglist = File.ReadAllLines("config\\qty.list").ToList().FindAll((s) => { return !string.IsNullOrWhiteSpace(s); }).ToArray(); qtyreglist = File.ReadAllLines("config\\qty.list").ToList().FindAll((s) => { return !string.IsNullOrWhiteSpace(s); }).ToArray();
} }
public static bool codeProcess(LabelParam labelParam,out string debugmsg) { public static bool codeProcess(LabelParam labelParam,out string debugmsg) {
debugmsg = "";
return labelParam.codeInfos.Count > 0;
if (pnreglist == null) if (pnreglist == null)
LoadMatchList(); LoadMatchList();
......
...@@ -35,6 +35,8 @@ namespace DeviceLibrary ...@@ -35,6 +35,8 @@ namespace DeviceLibrary
public string WareCode { get; set; } public string WareCode { get; set; }
public string bitmapfilename = ""; public string bitmapfilename = "";
public List<CodeInfo> codeInfos { get; set; } public List<CodeInfo> codeInfos { get; set; }
public Dictionary<string,string> Keyword { get; set; }
/// <summary> /// <summary>
/// 料盘高度 /// 料盘高度
/// </summary> /// </summary>
......
...@@ -169,6 +169,7 @@ namespace DeviceLibrary ...@@ -169,6 +169,7 @@ namespace DeviceLibrary
IOMove(IO_Type.LeftMoto_Run, IO_VALUE.HIGH); IOMove(IO_Type.LeftMoto_Run, IO_VALUE.HIGH);
LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LeftEnd_Check, IO_VALUE.HIGH)); LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LeftEnd_Check, IO_VALUE.HIGH));
LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(60000)); LeftMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(60000));
LeftMoveInfo.TimeOutSeconds = 60;
LeftMoveInfo.OneWaitCanEndStep = true; LeftMoveInfo.OneWaitCanEndStep = true;
LeftMoveInfo.log($"等待料串到位"); LeftMoveInfo.log($"等待料串到位");
break; break;
......
...@@ -63,20 +63,11 @@ namespace DeviceLibrary ...@@ -63,20 +63,11 @@ namespace DeviceLibrary
try try
{ {
LastPrintStatus= Asa.PrintLabel.PrinterStatus.Unknown; LastPrintStatus= Asa.PrintLabel.PrinterStatus.Unknown;
LogUtil.info("调用 PrintLabel 打印标签 StartPrintLabel ,[" + labelParam.WareCode + "] [" + labelParam.QTY + "] 开始"); var kv = labelParam.Keyword.Select(k => $"{k.Key}={k.Value}").ToArray();
LogUtil.info("调用 PrintLabel 打印标签 StartPrintLabel ,[" + string.Join(", ", kv) + "] 开始");
Dictionary<string, string> text = new Dictionary<string, string> //LastPrintLabel = labelParam.PN;
{ RobotManage.PrintBean.Print(labelParam.Keyword);
{ "code", labelParam.WareCode },
{ "ri", labelParam.RI },
{ "pn", labelParam.PN },
{ "batch", labelParam.Batch },
{ "qty", labelParam.QTY.ToString() }
};
LastPrintLabel = labelParam.PN;
RobotManage.PrintBean.Print(text);
LogUtil.info("PrintLabel 打印标签 StartPrintLabel 结束 "); LogUtil.info("PrintLabel 打印标签 StartPrintLabel 结束 ");
} }
catch (Exception ex) catch (Exception ex)
......
...@@ -8,6 +8,7 @@ using System.Drawing; ...@@ -8,6 +8,7 @@ using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.IO;
namespace DeviceLibrary namespace DeviceLibrary
{ {
...@@ -84,7 +85,14 @@ namespace DeviceLibrary ...@@ -84,7 +85,14 @@ namespace DeviceLibrary
case MoveStep.R06_GettedReelHigh: case MoveStep.R06_GettedReelHigh:
if (RightScanTask.IsCompleted) if (RightScanTask.IsCompleted)
{ {
var (x,s) = RightScanTask.Result; var (x,k,s) = RightScanTask.Result;
if (ConfigHelper.Config.Get(Setting_Init.SaveReelPhoto, false))
{
string d = ConfigHelper.Config.Get(Setting_Init.ReelPhotoSaveDir);
string fn = Path.GetFileName(s);
string df = Path.Combine(d,fn);
File.Copy(s, df);
}
if (x.Count == 0) if (x.Count == 0)
{ {
RightMoveInfo.log($"未识别到有效二维码,转入NG箱"); RightMoveInfo.log($"未识别到有效二维码,转入NG箱");
...@@ -95,6 +103,7 @@ namespace DeviceLibrary ...@@ -95,6 +103,7 @@ namespace DeviceLibrary
RightMoveInfo.MoveParam.IsNg = false; RightMoveInfo.MoveParam.IsNg = false;
RightMoveInfo.MoveParam.codeInfos = x; RightMoveInfo.MoveParam.codeInfos = x;
RightMoveInfo.MoveParam.Keyword = k;
RightMoveInfo.MoveParam.bitmapfilename = s; RightMoveInfo.MoveParam.bitmapfilename = s;
if (!Common.codeProcess(RightMoveInfo.MoveParam,out string debugmsg)) if (!Common.codeProcess(RightMoveInfo.MoveParam,out string debugmsg))
{ {
...@@ -131,6 +140,7 @@ namespace DeviceLibrary ...@@ -131,6 +140,7 @@ namespace DeviceLibrary
break; break;
case MoveStep.R12_ShelfNoTray: case MoveStep.R12_ShelfNoTray:
RightShelfNoTray = true; RightShelfNoTray = true;
ConfigHelper.Config.Set(Setting_Init.SaveReelPhoto, false);
RightMoveInfo.NextMoveStep(MoveStep.REND); RightMoveInfo.NextMoveStep(MoveStep.REND);
Right_Batch_Axis.AbsMove(RightMoveInfo, Config.Right_Batch_P1, Config.Right_Batch_P1_speed); Right_Batch_Axis.AbsMove(RightMoveInfo, Config.Right_Batch_P1, Config.Right_Batch_P1_speed);
RightMoveInfo.log($"料串已取完, 批量轴下降到P1"); RightMoveInfo.log($"料串已取完, 批量轴下降到P1");
...@@ -193,6 +203,7 @@ namespace DeviceLibrary ...@@ -193,6 +203,7 @@ namespace DeviceLibrary
IOMove(IO_Type.RightMoto_Run, IO_VALUE.HIGH); IOMove(IO_Type.RightMoto_Run, IO_VALUE.HIGH);
RightMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.RightEnd_Check, IO_VALUE.HIGH)); RightMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.RightEnd_Check, IO_VALUE.HIGH));
RightMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(60000)); RightMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(60000));
RightMoveInfo.TimeOutSeconds = 60;
RightMoveInfo.OneWaitCanEndStep = true; RightMoveInfo.OneWaitCanEndStep = true;
RightMoveInfo.log($"等待料串到位"); RightMoveInfo.log($"等待料串到位");
break; break;
...@@ -251,7 +262,7 @@ namespace DeviceLibrary ...@@ -251,7 +262,7 @@ namespace DeviceLibrary
/// <summary> /// <summary>
/// 扫码线程 /// 扫码线程
/// </summary> /// </summary>
Task<(List<CodeInfo>,string)> RightScanTask; Task<(List<CodeInfo>,Dictionary<string,string>,string)> RightScanTask;
void ScanCode() { void ScanCode() {
RightMoveInfo.log("开始扫码"); RightMoveInfo.log("开始扫码");
//RightMoveInfo.OneWaitCanEndStep = true; //RightMoveInfo.OneWaitCanEndStep = true;
...@@ -259,25 +270,26 @@ namespace DeviceLibrary ...@@ -259,25 +270,26 @@ namespace DeviceLibrary
//RightMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); //RightMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
try try
{ {
RightScanTask = Task.Run(new Func<(List<CodeInfo>,string)>(()=> RightScanTask = Task.Run(new Func<(List<CodeInfo>, Dictionary<string, string>,string)>(()=>
{ {
IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH); IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
string filename; string filename;
Task.Delay(10).Wait(); Task.Delay(10).Wait();
List<CodeInfo> LastCodeList, LastCodeList2; List<CodeInfo> LastCodeList, LastCodeList2;
(LastCodeList, filename) = CodeManager.CameraScan(new List<string> { Config.RightCameraName }); Dictionary<string, string> keyword;
(LastCodeList, keyword, filename) = CodeManager.CameraScan(new List<string> { Config.RightCameraName });
LabelParam labelParam = new LabelParam(); LabelParam labelParam = new LabelParam();
labelParam.codeInfos = new List<CodeInfo>(LastCodeList); labelParam.codeInfos = new List<CodeInfo>(LastCodeList);
if (!Common.codeProcess(labelParam, out _)) if (!Common.codeProcess(labelParam, out _))
{ {
Task.Delay(500).Wait(); Task.Delay(500).Wait();
(LastCodeList2, filename) = CodeManager.CameraScan(new List<string> { Config.RightCameraName }); (LastCodeList2, keyword, filename) = CodeManager.CameraScan(new List<string> { Config.RightCameraName });
LastCodeList.AddRange(LastCodeList2); LastCodeList.AddRange(LastCodeList2);
} }
//IOMove(IO_Type.Camera_Led, IO_VALUE.LOW); //IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
return (LastCodeList, filename); return (LastCodeList, keyword, filename);
})); }));
} }
catch (Exception ex) catch (Exception ex)
......
...@@ -108,7 +108,7 @@ namespace DeviceLibrary ...@@ -108,7 +108,7 @@ namespace DeviceLibrary
Label_Y_Axis.interference += Label_Y_Axis_interference; Label_Y_Axis.interference += Label_Y_Axis_interference;
Take_Middle_Axis.interference += Take_Middle_Axis_interference; Take_Middle_Axis.interference += Take_Middle_Axis_interference;
electricClamp = RobotManage.electricGripper; electricClamp = RobotManage.electricGripper;
CodeManager.LoadCamera(true);
AlarmBuzzer.SetOnOffAction(() => { IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.HIGH); }, () => { IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.LOW); }); AlarmBuzzer.SetOnOffAction(() => { IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.HIGH); }, () => { IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.LOW); });
InitPrint(); InitPrint();
...@@ -120,7 +120,7 @@ namespace DeviceLibrary ...@@ -120,7 +120,7 @@ namespace DeviceLibrary
private void Crc_LanguageChangeEvent(object sender, EventArgs e) private void Crc_LanguageChangeEvent(object sender, EventArgs e)
{ {
RightMoveInfo.Name=(crc.GetString("Res0039", "右侧取料")); RightMoveInfo.Name = (crc.GetString("Res0039", "右侧取料"));
MiddleMoveInfo.Name = (crc.GetString("Res0042", "移栽")); MiddleMoveInfo.Name = (crc.GetString("Res0042", "移栽"));
LeftMoveInfo.Name = (crc.GetString("Res0051", "左侧放料")); LeftMoveInfo.Name = (crc.GetString("Res0051", "左侧放料"));
...@@ -316,6 +316,8 @@ namespace DeviceLibrary ...@@ -316,6 +316,8 @@ namespace DeviceLibrary
break; break;
} }
} }
bool isAgvRun {get => LeftMoveInfo.MoveStep >= MoveStep.L60_InShelf || LeftMoveInfo.MoveStep >= MoveStep.L50_OutShelf
|| RightMoveInfo.MoveStep >= MoveStep.R30_OutShelf || RightMoveInfo.MoveStep >= MoveStep.R40_InShelf; }
public bool IgnoreSafecheck = false; public bool IgnoreSafecheck = false;
public bool IgnoreGratingSignal = false; public bool IgnoreGratingSignal = false;
...@@ -331,7 +333,7 @@ namespace DeviceLibrary ...@@ -331,7 +333,7 @@ namespace DeviceLibrary
} }
else if (IOValue(IO_Type.GratingSignal_Check).Equals(IO_VALUE.LOW)) else if (IOValue(IO_Type.GratingSignal_Check).Equals(IO_VALUE.LOW))
{ {
if (!IgnoreSafecheck && !IgnoreGratingSignal if (!IgnoreSafecheck && !IgnoreGratingSignal && !isAgvRun
&& IOValue(IO_Type.RightCar_Check).Equals(IO_VALUE.LOW) && IOValue(IO_Type.RightCar_Check).Equals(IO_VALUE.LOW)
&& IOValue(IO_Type.LeftCar_Check).Equals(IO_VALUE.LOW)) && IOValue(IO_Type.LeftCar_Check).Equals(IO_VALUE.LOW))
{ {
......
...@@ -35,7 +35,7 @@ namespace DeviceLibrary ...@@ -35,7 +35,7 @@ namespace DeviceLibrary
Config = new Robot_Config(0, "", configFile); Config = new Robot_Config(0, "", configFile);
Config = (Robot_Config)CSVConfigReader.LoadConfig(Config); Config = (Robot_Config)CSVConfigReader.LoadConfig(Config);
CodeManager.LoadConfig(); CodeManager.LoadConfig();
PrintBean = new Asa.PrintLabel(Application.StartupPath + "\\Label"); PrintBean = new Asa.PrintLabel(Application.StartupPath + "\\Label",100);
var ElectricGripperPort = ConfigHelper.Config.Get("ElectricGripperPort"); var ElectricGripperPort = ConfigHelper.Config.Get("ElectricGripperPort");
electricGripper = new ElectricGripper(); electricGripper = new ElectricGripper();
......
...@@ -79,7 +79,7 @@ namespace DeviceLibrary ...@@ -79,7 +79,7 @@ namespace DeviceLibrary
LogUtil.error("解析摄像机配置出错:" + ex.StackTrace); LogUtil.error("解析摄像机配置出错:" + ex.StackTrace);
} }
} }
private static void LoadCamera(bool isReLoad) public static void LoadCamera(bool isReLoad)
{ {
if (isReLoad || Camera._cam == null) if (isReLoad || Camera._cam == null)
{ {
...@@ -128,9 +128,10 @@ namespace DeviceLibrary ...@@ -128,9 +128,10 @@ namespace DeviceLibrary
[HandleProcessCorruptedStateExceptions] [HandleProcessCorruptedStateExceptions]
public static (List<CodeInfo>,string) CameraScan(List<string> cameraNameList) public static (List<CodeInfo>, Dictionary<string, string>, string) CameraScan(List<string> cameraNameList)
{ {
List<CodeInfo> codeList = new List<CodeInfo>(); List<CodeInfo> codeList = new List<CodeInfo>();
Dictionary<string, string> keyword = new Dictionary<string, string>();
string bitmapfilename = ""; string bitmapfilename = "";
if (cameraNameList == null || cameraNameList.Count <= 0) if (cameraNameList == null || cameraNameList.Count <= 0)
{ {
...@@ -152,65 +153,44 @@ namespace DeviceLibrary ...@@ -152,65 +153,44 @@ namespace DeviceLibrary
Bitmap bmp = null; Bitmap bmp = null;
try try
{ {
bool nohalcon = false; bool nohalcon = true;
ho_Image = Camera._cam.CaptureOnImage(cameraName, out bmp, nohalcon); _ = Camera._cam.CaptureOnImage(cameraName, out bmp, nohalcon);
//HalconDotNet.HOperatorSet.RotateImage() //HalconDotNet.HOperatorSet.RotateImage()
if (ho_Image == null && !nohalcon) if (bmp == null)
{ {
LogUtil.error(" 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机"); LogUtil.error(" 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
CloseCamera(cameraName); LoadCamera(true);
continue; continue;
} }
LogUtil.info(" 【" + cameraName + "】取图片完成,开始扫码"); LogUtil.info(" 【" + cameraName + "】取图片完成,开始扫码");
string r = ""; string r = "";
RemoteDecodeHelper_mod.RemoteDecodeParam remoteDecodeParam = new RemoteDecodeHelper_mod.RemoteDecodeParam();
//bmp.RotateFlip(RotateFlipType.Rotate270FlipNone); var cc = RemoteDecodeHelper_mod.DecodeRequest(bmp, remoteDecodeParam);
//List<CodeInfo> tlci = EyemDecode2.Decoder(ref bmp);
//foreach (CodeInfo code in tlci) if (cc == null)
//{
// LogUtil.info(" 【" + cameraName + "】[eyemDecode]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr);
// //string str = CodeManager.ReplaceCode(code.CodeStr);
// lock (codeList)
// {
// if (!codeList.Contains(code))
// {
// codeList.Add(code);
// r = r + "##" + code.CodeStr;
// }
// }
//}
List<CodeInfo> cc = new List<CodeInfo>();
foreach (string codeType in codeTypeList)
{
//判断是否是一维码
if (codeType.ToLower().Equals("barcode"))
{ {
cc = HDCodeHelper.DecodeBarCode(ho_Image); LogUtil.info(" 【" + cameraName + "】调用外部转码失败");
} }
else else if (cc.ErrorCode != 0)
{ {
cc = HDCodeHelper.DecodeCode(ho_Image, codeType, GetCodeParamFilePath(codeType), QRCodeCount, 3000); LogUtil.info(" 【" + cameraName + "】调用外部转码错误:" + cc.ErrorCode + "," + cc.Msg);
cc.ForEach((x) => { x.CodeType = codeType; });
} }
LogUtil.info(" 【" + cameraName + "】[Halcon]" + codeType + "," + QRCodeCount + "," + cc.Count); else
foreach (CodeInfo c in cc)
{
LogUtil.info(" 【" + cameraName + "】[Halcon]" + c.CodeType + "(X: " + c.X + ",Y: " + c.Y + ") " + c.CodeStr);
c.CodeStr = CodeManager.ReplaceCode(c.CodeStr);
lock (codeList)
{ {
if (!codeList.Contains(c)) foreach (var code in cc.workCodeInfo)
{ {
codeList.Add(c); codeList.Add(new CodeInfo(code.Text,(int)code.Center.X, (int)code.Center.Y,code.CodeType));
r = r + "##" + c.CodeStr; r = r + "##" + code.CodeType +":"+ code.Text;
}
} }
foreach (var code in cc.workCodeKeyword)
{
if (!keyword.ContainsKey(code.Key))
keyword.Add(code.Key, code.Value);
} }
} }
//if (codeList.Count() == 0) //if (codeList.Count() == 0)
//{ //{
bitmapfilename =SaveImageToFile("mimo", cameraName, bmp); bitmapfilename =SaveImageToFile("mimo", cameraName, bmp);
...@@ -249,7 +229,7 @@ namespace DeviceLibrary ...@@ -249,7 +229,7 @@ namespace DeviceLibrary
LogUtil.error( " 扫码出错:" + ex.ToString()); LogUtil.error( " 扫码出错:" + ex.ToString());
//throw new Exception("扫码出错"); //throw new Exception("扫码出错");
} }
return (codeList,bitmapfilename); return (codeList, keyword, bitmapfilename);
} }
/// <summary> /// <summary>
/// ///
...@@ -276,6 +256,7 @@ namespace DeviceLibrary ...@@ -276,6 +256,7 @@ namespace DeviceLibrary
{ {
Directory.CreateDirectory(dire); Directory.CreateDirectory(dire);
} }
DelOverDayFile(dire, "*.bmp", 7);
bit.Save(dire + iamgeName, ImageFormat.Bmp); bit.Save(dire + iamgeName, ImageFormat.Bmp);
bit.Dispose(); bit.Dispose();
LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成,保存图片到【" + dire + iamgeName + "】成功"); LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成,保存图片到【" + dire + iamgeName + "】成功");
...@@ -287,7 +268,27 @@ namespace DeviceLibrary ...@@ -287,7 +268,27 @@ namespace DeviceLibrary
} }
return dire + iamgeName; return dire + iamgeName;
} }
static void DelOverDayFile(string path, string ext, int day)
{
DateTime n = DateTime.Now;
if (!Directory.Exists(path))
return;
string[] files = Directory.GetFiles(path, ext);
foreach (string file in files)
{
try
{
var fi = new FileInfo(file);
var t = n - fi.LastWriteTime;
if (t.TotalDays > day)
{
fi.Delete();
}
}
catch { }
}
}
/// <summary> /// <summary>
/// 处理接收后的二维码 /// 处理接收后的二维码
/// </summary> /// </summary>
......
...@@ -34,7 +34,7 @@ namespace DeviceLibrary ...@@ -34,7 +34,7 @@ namespace DeviceLibrary
{ {
GripperType = GripperTypeE.Gripper; GripperType = GripperTypeE.Gripper;
if (moveInfo != null) if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(WaitAction),crc.GetString(crc.GetString("Res0102","Form1_tabControl1___IOControl_groupBox1_btn夹爪夹紧_Text"),"夹爪夹紧"))); moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(WaitAction), crc.GetString("Res0102", "夹爪夹紧")));
if (!IsBusy) if (!IsBusy)
{ {
axis.ResetError(); axis.ResetError();
...@@ -71,7 +71,7 @@ namespace DeviceLibrary ...@@ -71,7 +71,7 @@ namespace DeviceLibrary
else else
{ {
if (moveInfo != null) if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(WaitAction), crc.GetString(crc.GetString("Res0103","Form1_tabControl1___IOControl_groupBox1_btn夹爪放松_Text"),"夹爪放松"))); moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(WaitAction), crc.GetString("Res0103", "夹爪放松")));
return false; return false;
} }
} }
......
using CodeLibrary;
using HalconDotNet;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
public class RemoteDecodeHelper_mod
{
static int webclienttimeout = 30 * 1000;
static Process p = new Process();
const string serverhost = "http://127.0.0.1:58137/";
public static WebResultCode DecodeRequest(Bitmap bitmap, RemoteDecodeParam remoteDecodeParam)
{
CheckAndRunServer();
if (bitmap == null)
return null;
byte[] requestdata;
lock (bitmap)
{
using (MemoryStream mStream = new MemoryStream())
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(mStream, bitmap);
requestdata = mStream.ToArray();
mStream.Close();
}
}
return DecodeRequest(requestdata, remoteDecodeParam);
}
static WebResultCode DecodeRequest(byte[] requestdata, RemoteDecodeParam remoteDecodeParam,bool isHObject=false)
{
//CheckAndRunServer();
string param;
using (MemoryStream mStreamparam = new MemoryStream())
{
XmlSerializer xf = new XmlSerializer(typeof(RemoteDecodeParam));
xf.Serialize(mStreamparam, remoteDecodeParam);
param = base64UrlEncode(mStreamparam.ToArray());
mStreamparam.Close();
}
string url = serverhost+ "NeoScan/ProcessBitmap?param=";
if (isHObject)
url = serverhost+ "NeoScan/Process?param=";
byte[] resp;
try
{
MyWebClient webClient = new MyWebClient(webclienttimeout);
resp = webClient.UploadData(url + param, requestdata);
requestdata = null;
webClient.Dispose();
}
catch(WebException we)
{
return null;
}
catch
{
return null;
}
WebResultCode codeInfos = null;
var ss = Encoding.UTF8.GetString(resp);
try
{
codeInfos = JsonConvert.DeserializeObject<WebResultCode>(ss);
}
catch (Exception ex)
{
throw new Exception("数据解析出错:" + ex + "\r\n" + ss);
}
return codeInfos;
}
/// <summary>
/// 在url中传递base64字符串需要替换加号等符号
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
static string base64UrlEncode(byte[] input)
{
return Convert.ToBase64String(input).Replace('+', '-').Replace('/', '_');
}
/// <summary>
/// 检查并自动启动服务器
/// </summary>
static void CheckAndRunServer()
{
lock (p)
{
var pss = Process.GetProcessesByName("SmartScan");
if (pss.Length > 0)
return;
var f = "SmartScan\\SmartScan.exe";
if (!File.Exists(f))
throw new Exception("找不到扫码服务器文件");
p.StartInfo = new ProcessStartInfo(f);
p.StartInfo.Arguments = "hide";
p.Start();
int checkcount = 5;
while (checkcount > 0)
{
checkcount--;
Thread.Sleep(500);
MyWebClient webClient = new MyWebClient(webclienttimeout);
var s = webClient.DownloadString(serverhost + "alive");
if (s.Trim() == "\"1\"")
return;
}
throw new Exception("扫码服务器打开失败");
}
}
[Serializable]
public struct RemoteDecodeParam
{
public string[] codeTypeList;
public int codeCount;
public int timeout;
}
[Serializable]
public class WebResultCode
{
public int ErrorCode { get; set; }
public string Msg { get; set; }
//public WebCodeText[] Data { get; set; }
public List<KeyValuePair<string,string>> workCodeKeyword;
public List<BarcodeInfo> workCodeInfo;
public WebResultCode()
{
ErrorCode = 0;
Msg = "OK";
}
}
//
// 摘要:
// 条码信息,1DBarcode、2DBarcode
[Serializable]
public class BarcodeInfo
{
//
// 摘要:
// 文本
public string Text { get; set; }
//
// 摘要:
// 条码类型
public string CodeType { get; set; }
//
// 摘要:
// 中心点
public PointF Center { get; set; }
//
// 摘要:
// 角度,3点钟方向0°,逆时针为正,顺时针为负。
public float Angle { get; set; }
//
// 摘要:
// 条码尺寸大小
//public SizeF Size { get; set; }
//
// 摘要:
// 原点垂直于经过中心点的直线的距离
public float Distance { get; set; }
}
public class MyWebClient : WebClient
{
private int _timeout;
public MyWebClient(int timeout)
{
this._timeout = timeout;
}
protected override WebRequest GetWebRequest(Uri address)
{
var result = base.GetWebRequest(address);
result.Timeout = this._timeout;
return result;
}
}
}
...@@ -38,6 +38,9 @@ namespace DeviceLibrary ...@@ -38,6 +38,9 @@ namespace DeviceLibrary
} }
public void LoadData(IRobot equipBase, bool isHc = true) public void LoadData(IRobot equipBase, bool isHc = true)
{ {
if (equipBase == null)
return;
this.boxBean = equipBase; this.boxBean = equipBase;
axisList = new List<ConfigMoveAxis>(equipBase.Config.moveAxisList); axisList = new List<ConfigMoveAxis>(equipBase.Config.moveAxisList);
......
此文件类型无法预览
...@@ -217,13 +217,13 @@ ...@@ -217,13 +217,13 @@
</member> </member>
<member name="M:ConfigHelper.MyConfig`1.op_Implicit(ConfigHelper.MyConfig{`0})~`0"> <member name="M:ConfigHelper.MyConfig`1.op_Implicit(ConfigHelper.MyConfig{`0})~`0">
<summary> <summary>
隐式转换 隐式转换,读值
</summary> </summary>
<param name="m1"></param> <param name="m1"></param>
</member> </member>
<member name="M:ConfigHelper.MyConfig`1.op_Implicit(`0)~ConfigHelper.MyConfig{`0}"> <member name="M:ConfigHelper.MyConfig`1.op_Implicit(`0)~ConfigHelper.MyConfig{`0}">
<summary> <summary>
隐式转换 隐式转换,写值
</summary> </summary>
<param name="v1"></param> <param name="v1"></param>
</member> </member>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!