Commit 1c7c60c0 刘韬

越南纬创稳定版本

1 个父辈 92a16664
正在显示 42 个修改的文件 包含 1377 行增加219 行删除
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
......@@ -39,6 +39,14 @@
</root>-->
</log4net>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
\ No newline at end of file
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
......@@ -8,10 +8,11 @@
<OutputType>WinExe</OutputType>
<RootNamespace>AutoScanAndLabel</RootNamespace>
<AssemblyName>AutoScanAndLabel</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>false</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
......
......@@ -39,6 +39,8 @@ namespace AutoScanAndLabel
this.关于ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.btn_PauseBuzzer = new System.Windows.Forms.Button();
this.cb_EnableBuzzer = new System.Windows.Forms.CheckBox();
this.btn_maulstart = new System.Windows.Forms.Button();
this.btn_releaserightshelf = new System.Windows.Forms.Button();
this.btn_releaseleftshelf = new System.Windows.Forms.Button();
......@@ -49,8 +51,7 @@ namespace AutoScanAndLabel
this.listView1 = new System.Windows.Forms.ListView();
this.btn_stop = new System.Windows.Forms.Button();
this.btn_run = new System.Windows.Forms.Button();
this.cb_EnableBuzzer = new System.Windows.Forms.CheckBox();
this.btn_PauseBuzzer = new System.Windows.Forms.Button();
this.btn_leftempty = new System.Windows.Forms.Button();
this.menuStrip1.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
......@@ -139,6 +140,7 @@ namespace AutoScanAndLabel
//
this.tabPage1.Controls.Add(this.btn_PauseBuzzer);
this.tabPage1.Controls.Add(this.cb_EnableBuzzer);
this.tabPage1.Controls.Add(this.btn_leftempty);
this.tabPage1.Controls.Add(this.btn_maulstart);
this.tabPage1.Controls.Add(this.btn_releaserightshelf);
this.tabPage1.Controls.Add(this.btn_releaseleftshelf);
......@@ -152,13 +154,36 @@ namespace AutoScanAndLabel
this.tabPage1.Text = "信息";
this.tabPage1.UseVisualStyleBackColor = true;
//
// btn_PauseBuzzer
//
this.btn_PauseBuzzer.BackColor = System.Drawing.Color.OrangeRed;
this.btn_PauseBuzzer.Location = new System.Drawing.Point(653, 135);
this.btn_PauseBuzzer.Name = "btn_PauseBuzzer";
this.btn_PauseBuzzer.Size = new System.Drawing.Size(201, 40);
this.btn_PauseBuzzer.TabIndex = 6;
this.btn_PauseBuzzer.Text = "本次暂停警报器响声";
this.btn_PauseBuzzer.UseVisualStyleBackColor = false;
this.btn_PauseBuzzer.Visible = false;
this.btn_PauseBuzzer.Click += new System.EventHandler(this.btn_PauseBuzzer_Click);
//
// cb_EnableBuzzer
//
this.cb_EnableBuzzer.AutoSize = true;
this.cb_EnableBuzzer.Location = new System.Drawing.Point(653, 42);
this.cb_EnableBuzzer.Name = "cb_EnableBuzzer";
this.cb_EnableBuzzer.Size = new System.Drawing.Size(109, 25);
this.cb_EnableBuzzer.TabIndex = 5;
this.cb_EnableBuzzer.Text = "使用蜂鸣器";
this.cb_EnableBuzzer.UseVisualStyleBackColor = true;
this.cb_EnableBuzzer.CheckedChanged += new System.EventHandler(this.cb_EnableBuzzer_CheckedChanged);
//
// btn_maulstart
//
this.btn_maulstart.Location = new System.Drawing.Point(653, 349);
this.btn_maulstart.Location = new System.Drawing.Point(763, 349);
this.btn_maulstart.Name = "btn_maulstart";
this.btn_maulstart.Size = new System.Drawing.Size(201, 42);
this.btn_maulstart.Size = new System.Drawing.Size(91, 85);
this.btn_maulstart.TabIndex = 4;
this.btn_maulstart.Text = "手动上料";
this.btn_maulstart.Text = "右侧\r\n手动上料";
this.btn_maulstart.UseVisualStyleBackColor = true;
this.btn_maulstart.Click += new System.EventHandler(this.btn_maulstart_Click);
//
......@@ -265,28 +290,15 @@ namespace AutoScanAndLabel
this.btn_run.UseVisualStyleBackColor = true;
this.btn_run.Click += new System.EventHandler(this.btn_run_Click);
//
// cb_EnableBuzzer
//
this.cb_EnableBuzzer.AutoSize = true;
this.cb_EnableBuzzer.Location = new System.Drawing.Point(653, 42);
this.cb_EnableBuzzer.Name = "cb_EnableBuzzer";
this.cb_EnableBuzzer.Size = new System.Drawing.Size(109, 25);
this.cb_EnableBuzzer.TabIndex = 5;
this.cb_EnableBuzzer.Text = "使用蜂鸣器";
this.cb_EnableBuzzer.UseVisualStyleBackColor = true;
this.cb_EnableBuzzer.CheckedChanged += new System.EventHandler(this.cb_EnableBuzzer_CheckedChanged);
//
// btn_PauseBuzzer
// btn_leftempty
//
this.btn_PauseBuzzer.BackColor = System.Drawing.Color.OrangeRed;
this.btn_PauseBuzzer.Location = new System.Drawing.Point(653, 135);
this.btn_PauseBuzzer.Name = "btn_PauseBuzzer";
this.btn_PauseBuzzer.Size = new System.Drawing.Size(201, 40);
this.btn_PauseBuzzer.TabIndex = 6;
this.btn_PauseBuzzer.Text = "本次暂停警报器响声";
this.btn_PauseBuzzer.UseVisualStyleBackColor = false;
this.btn_PauseBuzzer.Visible = false;
this.btn_PauseBuzzer.Click += new System.EventHandler(this.btn_PauseBuzzer_Click);
this.btn_leftempty.Location = new System.Drawing.Point(653, 349);
this.btn_leftempty.Name = "btn_leftempty";
this.btn_leftempty.Size = new System.Drawing.Size(91, 85);
this.btn_leftempty.TabIndex = 4;
this.btn_leftempty.Text = "左侧\r\n手动清空";
this.btn_leftempty.UseVisualStyleBackColor = true;
this.btn_leftempty.Click += new System.EventHandler(this.btn_leftempty_Click);
//
// Form1
//
......@@ -340,6 +352,7 @@ namespace AutoScanAndLabel
private System.Windows.Forms.ToolStripMenuItem 关于ToolStripMenuItem;
private System.Windows.Forms.CheckBox cb_EnableBuzzer;
private System.Windows.Forms.Button btn_PauseBuzzer;
private System.Windows.Forms.Button btn_leftempty;
}
}
......@@ -97,13 +97,15 @@ namespace AutoScanAndLabel
cb_EnableBuzzer.Checked = Config.Get("EnableBuzzer", true);
AlarmBuzzer.BuzzerStateChange += AlarmBuzzer_BuzzerStateChange;
RobotManage.LoadFinishEvent += RobotManage_LoadFinishEvent;
AddForm("日志", lc);
RobotManage.Init();
}
private void AlarmBuzzer_BuzzerStateChange(object sender, bool e)
{
btn_PauseBuzzer.Visible = e;
this.Invoke((EventHandler<bool>)delegate {
btn_PauseBuzzer.Visible = e;
}, sender, e);
}
private void listView_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e)
......@@ -115,7 +117,7 @@ namespace AutoScanAndLabel
AddForm("IO调试", ioc);
AddForm("伺服调试", ac);
AddForm("相关设置", sc);
AddForm("日志", lc);
}
//public delegate void setstatedelegate(List<MoveInfo> moveinfoList);
private void MainMachine_ProcessMoveinfoEvent(List<MoveInfo> moveinfoList)
......@@ -144,7 +146,7 @@ namespace AutoScanAndLabel
ListViewItem lvi1 = new ListViewItem(new string[] { "", "Printer", (printstatus == Asa.PrintLabel.PrinterStatus.Unknown)?"Wait": printstatus.ToString(), ConfigHelper.Config.Get(Setting_Init.PrinterName) });
stateView.Items.Add(lvi1);
this.ResumeLayout(true);
}
private void AddForm(string text, UserControl form)
{
......@@ -177,11 +179,12 @@ namespace AutoScanAndLabel
if (RobotManage.IsDebug)
{
RobotManage.Config = (Robot_Config)CSVConfigReader.LoadConfig(RobotManage.Config);
addTablePage();
RobotManage.LoadDebug();
}
else {
for (int i = tabControl1.TabPages.Count-1; i > 0; i--)
for (int i = tabControl1.TabPages.Count-1; i > 1; i--)
{
tabControl1.TabPages[i].Parent = null;
}
......@@ -293,21 +296,39 @@ namespace AutoScanAndLabel
private void 二维码识别调试ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (RobotManage.mainMachine.IsScanRunning())
{
MessageBox.Show("扫码还没完成,无法打开调试!请稍后再试.");
return;
}
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
if (Camera._cam != null)
{
Camera._cam.CloseAll();
}
CodeLibrary.FrmCodeDecode frm = new CodeLibrary.FrmCodeDecode();
frm.chbZxing.Checked = false;
frm.ShowDialog();
frm.Dispose();
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
//IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
}
private void btn_releaseleftshelf_Click(object sender, EventArgs e)
{
if (RobotManage.mainMachine.SafeReleaseLeftShelf || RobotManage.mainMachine.LeftMoveInfo.MoveStep < MoveStep.L01 || RobotManage.mainMachine.LeftMoveInfo.MoveStep > MoveStep.L30_LabelFinish) {
MessageBox.Show("左侧料串当前没有就位, 不能释放");
if (RobotManage.mainMachine.LeftMoveInfo.MoveStep == MoveStep.Wait)
{
MessageBox.Show("料串已是释放状态");
return;
}
else if (RobotManage.mainMachine.SafeReleaseLeftShelf)
{
MessageBox.Show("正在执行料串释放");
return;
}
else if (RobotManage.mainMachine.LeftMoveInfo.MoveStep < MoveStep.L04 || RobotManage.mainMachine.LeftMoveInfo.MoveStep > MoveStep.L30_LabelFinish)
{
MessageBox.Show("左侧料串正在提升或下降, 不能释放");
return;
}
......@@ -325,11 +346,12 @@ namespace AutoScanAndLabel
btn_releaseleftshelf.Text = $"左侧料串等待释放中({timeout / 2})";
});
}
if ((RobotManage.mainMachine.LeftMoveInfo.MoveStep== MoveStep.L20_WaitLabel || RobotManage.mainMachine.LeftMoveInfo.MoveStep== MoveStep.L10_WaitReelPut) && RobotManage.mainMachine.RightMoveInfo.MoveStep == MoveStep.Wait)
if ((RobotManage.mainMachine.LeftMoveInfo.MoveStep== MoveStep.L20_WaitLabel || RobotManage.mainMachine.LeftMoveInfo.MoveStep== MoveStep.L10_WaitReelPut) && (RobotManage.mainMachine.RightMoveInfo.MoveStep == MoveStep.Wait || RobotManage.mainMachine.RightMoveInfo.MoveStep == MoveStep.REND))
{
RobotManage.mainMachine.LeftMoveInfo.NextMoveStep(MoveStep.L30_LabelFinish);
}
}
RobotManage.mainMachine.SafeReleaseLeftShelf = false;
Invoke((EventHandler)delegate
{
btn_releaseleftshelf.BackColor = Color.Transparent;
......@@ -339,7 +361,17 @@ namespace AutoScanAndLabel
}
private void btn_releaserightshelf_Click(object sender, EventArgs e)
{
if (RobotManage.mainMachine.SafeReleaseRightShelf || RobotManage.mainMachine.RightMoveInfo.MoveStep < MoveStep.R01 || RobotManage.mainMachine.RightMoveInfo.MoveStep > MoveStep.R11_NextReel)
if (RobotManage.mainMachine.RightMoveInfo.MoveStep == MoveStep.Wait)
{
MessageBox.Show("料串已是释放状态");
return;
}
else if (RobotManage.mainMachine.SafeReleaseRightShelf)
{
MessageBox.Show("正在执行料串释放");
return;
}
else if (RobotManage.mainMachine.RightMoveInfo.MoveStep < MoveStep.R04 || RobotManage.mainMachine.RightMoveInfo.MoveStep > MoveStep.R11_NextReel)
{
MessageBox.Show("右侧料串当前没有就位, 不能释放");
return;
......@@ -361,6 +393,7 @@ namespace AutoScanAndLabel
});
}
}
RobotManage.mainMachine.SafeReleaseRightShelf =false;
Invoke((EventHandler)delegate
{
btn_releaserightshelf.BackColor = Color.Transparent;
......@@ -401,5 +434,22 @@ namespace AutoScanAndLabel
{
AlarmBuzzer.MuteOnce();
}
private void btn_leftempty_Click(object sender, EventArgs e)
{
if (RobotManage.mainMachine.LeftMoveInfo.MoveStep != MoveStep.Wait
&& RobotManage.mainMachine.LeftMoveInfo.MoveStep != MoveStep.L10_WaitReelPut)
{
MessageBox.Show("左侧料串正在运行,不能手动上料");
return;
}
if (RobotManage.mainMachine.IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.LOW))
{
MessageBox.Show("没有检测到料串,不能手动上料");
return;
}
RobotManage.mainMachine.LeftMoveInfo.NewMove(MoveStep.L01);
LogUtil.info("手动:左侧已清空,重新上升");
}
}
}
......@@ -19,6 +19,19 @@ namespace AutoScanAndLabel
[STAThread]
static void Main()
{
DeviceLibrary.LabelParam labelParam = new DeviceLibrary.LabelParam();
labelParam.codeInfos = new List<CodeLibrary.CodeInfo>();
//##340093060037##01410000441770##012100000224##Q3000
labelParam.codeInfos.Add(new CodeLibrary.CodeInfo("SMA5J16A-E3/61-GREE;SMA5J16A-E3/61;2108;1800;CHINA;MA703552.3", 0, 0));
labelParam.codeInfos.Add(new CodeLibrary.CodeInfo("[)>P1PTLV7022DGKR6P2PAQ25000V00333171T0557736ZEW4WTKYD210631T1032393ASH20LRFB21LUSA22LASH23LCHNEG43Z1/260C/UNLIM;//;022121L18087KN01", 0, 0));
labelParam.codeInfos.Add(new CodeLibrary.CodeInfo("99700736000619EM6H38.125008625", 0, 0));
labelParam.codeInfos.Add(new CodeLibrary.CodeInfo("Y38073304TLP385(D4GREETRE (T 00003000A0149T 03000WT0HBGCC8210B3F-5595 2009 2009JPTH 00 67 91432487 02Q", 0, 0));
labelParam.codeInfos.Add(new CodeLibrary.CodeInfo("01410000441770", 0, 0));
labelParam.codeInfos.Add(new CodeLibrary.CodeInfo("012100000224", 0, 0));
labelParam.codeInfos.Add(new CodeLibrary.CodeInfo("Q3000", 0, 0));
labelParam.codeInfos.Add(new CodeLibrary.CodeInfo("340093060037", 0, 0, "Code 128"));
DeviceLibrary.Common.codeProcess(labelParam);
_ = new Mutex(true, Application.ProductName, out bool ret);
if (!ret)
......
......@@ -12,7 +12,7 @@ namespace AutoScanAndLabel.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
......@@ -117,19 +117,20 @@ namespace AutoScanAndLabel
private void btn_labelDebug_Click(object sender, EventArgs e)
{
Bitmap bitmap = new Bitmap("16-51-26-94.bmp");
List<CodeInfo> tlci = EyemDecode2.Decoder(ref bitmap);
bitmap.Dispose();
tlci.Add(new CodeInfo("", 1453, 3556));
//Bitmap bitmap = new Bitmap("16-51-26-94.bmp");
//List<CodeInfo> tlci = EyemDecode2.Decoder(ref bitmap);
//bitmap.Dispose();
List<CodeInfo> tlci = new List<CodeInfo>();
tlci.Add(new CodeInfo("", 413, 1809));
LabelParam labelParam = new LabelParam();
labelParam.codeInfos = tlci;
labelParam.bitmapfilename = "16-51-26-94.bmp";
labelParam.bitmapfilename = @"D:\logs\827\15-02-40-402.bmp";
LabelParam aaa = labelParam.clone();
Point Right_Batch_Point = new Point(RobotManage.Config.Right_Batch_X, RobotManage.Config.Right_Batch_Y);
Point p = Common.CalcLabelPoint(labelParam, Right_Batch_Point, RobotManage.Config.Label_R_Offset, out int labelAngle);
Point p = Common.CalcLabelPoint(labelParam, Right_Batch_Point, RobotManage.Config.Label_R_Offset, RobotManage.Config.Label_R_Angle_Diff, out int labelAngle);
//匹配照片角度与贴标旋转轴的角度差
labelAngle += RobotManage.Config.Label_R_Angle_Diff;
//计算贴标角度的脉冲值
int labelAxisPos = RobotManage.Config.Label_R_360 / 360 * labelAngle;
......
using DeviceLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
......@@ -93,8 +94,10 @@ namespace AutoScanAndLabel
textBox.Text = configBase.ProValue;
textBox.KeyPress += TextBox_KeyPress;
textBox.TextChanged += TextBox_TextChanged;
textBox.Click += TextBox_Click;
tableLayoutPanel1.Controls.Add(textBox, c + 1, r);
PropertyInfo pi = Config.GetType().GetProperty(configBase.ProName);
......@@ -135,6 +138,18 @@ namespace AutoScanAndLabel
}
}
private void TextBox_Click(object sender, EventArgs e)
{
var c = (Control)sender;
var cn = c.Parent.Controls[c.Name + "_speed"];
var ct = c.Parent.Controls[c.Name];
if (cn == null) return;
var axisid = (short)((int)cn.Tag - 10);
AxisTipControl axisTip = new AxisTipControl();
axisTip.ShowTips((Control)sender,ct.Text, axisid, int.Parse(cn.Text));
//axisTip.ShowDialog();
}
private void TextBox_TextChanged(object sender, EventArgs e)
{
var lastlen = lastvalue.Length;
......@@ -173,12 +188,25 @@ namespace AutoScanAndLabel
}
private void Button_Click(object sender, EventArgs e)
{
var cc = tableLayoutPanel1.Controls.Find(((Button)sender).Name, false);
var speed = tableLayoutPanel1.Controls.Find(((Button)sender).Name+ "_speed", false);
if (MessageBox.Show($"{((Button)sender).Text} : {cc[1].Text}", "请确认是否运动到该位置", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
return;
LogUtil.info($"人工点击:{((Button)sender).Text} : {cc[1].Text}");
ConfigMoveAxis configMoveAxis = getConfigMoveAxis((int)((Button)sender).Tag);
AxisManager.AbsMove("", configMoveAxis.GetAxisValue(), int.Parse(cc[1].Text), int.Parse(speed[0].Text), configMoveAxis.AddSpeed, configMoveAxis.DelSpeed);
var axisb = AxisBean.List.Single((ax) => { return ax.Config.IsSameAxis("", configMoveAxis.GetAxisValue()); });
if (!axisb.IsSafe(int.Parse(cc[1].Text),out string msg))
{
MessageBox.Show(msg);
return;
}
AxisManager.AbsMove("", configMoveAxis.GetAxisValue(), int.Parse(cc[1].Text), int.Parse(speed[0].Text), int.Parse(speed[0].Text) * 4, int.Parse(speed[0].Text) * 4);//, configMoveAxis.AddSpeed, configMoveAxis.DelSpeed);
}
ConfigMoveAxis getConfigMoveAxis(int Axisid)
{
......@@ -207,6 +235,9 @@ namespace AutoScanAndLabel
PropertyInfo pi = Config.GetType().GetProperty(textBox.Name);
if (pi != null)
{
var cc = Config.configList.Find(new Predicate<ConfigBase>((c) => { return c.ProName == textBox.Name; }));
if (cc != null)
cc.ProValue = textBox.Text;
if (pi.PropertyType.Name == "Int32")
pi.SetValue(Config, int.Parse(textBox.Text));
else if (pi.PropertyType.Name == "Double")
......
......@@ -37,8 +37,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\dll\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
......@@ -71,6 +71,9 @@
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
......
......@@ -51,5 +51,7 @@ namespace OnlineStore.Common
public static string UseLabel = "UseLabel";
public static string CodeType = "CodeType";
public static string CodeParamPath = "CodeParamPath";
public static string QRCodeCount = "QRCodeCount";
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" />
</packages>
\ No newline at end of file
......@@ -18,7 +18,10 @@ namespace DeviceLibrary
/// 正常工作过程中判断位置是否到达时使用
/// </summary>
public int LastPosition = 0;
/// <summary>
/// 干涉检测回调 from, to
/// </summary>
public event Func<int,int,(bool,string)> interference;
public string AxisName;
public AxisBean(ConfigMoveAxis axisConfig, string deviceName)
{
......@@ -109,7 +112,7 @@ namespace DeviceLibrary
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(Config, targetPosition, targetSpeed));
Config.TargetPosition = targetPosition;
AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, Config.AddSpeed, Config.DelSpeed);
AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, targetSpeed * 4, targetSpeed * 4);// Config.AddSpeed, Config.DelSpeed);
}
}
......@@ -148,13 +151,13 @@ namespace DeviceLibrary
Thread.Sleep(200);
}
}
if (String.IsNullOrEmpty(clearMsg))
if (string.IsNullOrEmpty(clearMsg))
{
AxisManager.SuddenStop(axis.DeviceName, axis.GetAxisValue());
Thread.Sleep(100);
}
LogUtil.error($"{ MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr}目标位置{targetPosition}当前位置{outCount},误差过大,{clearMsg}重新开始运动,剩余{MoveInfo.CanWhileCount}次");
AxisManager.AbsMove(axis.DeviceName, axis.GetAxisValue(), targetPosition, targetSpeed, axis.AddSpeed, axis.DelSpeed);
AxisManager.AbsMove(axis.DeviceName, axis.GetAxisValue(), targetPosition, targetSpeed, targetSpeed * 4, targetSpeed * 4);// , axis.AddSpeed, axis.DelSpeed);
MoveInfo.CanWhileCount--;
Thread.Sleep(200);
}
......@@ -230,13 +233,25 @@ namespace DeviceLibrary
{
targetSpeed = Config.TargetSpeed * targetSpeed;
}
AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPos, (int)targetSpeed, Config.AddSpeed, Config.DelSpeed);
AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPos, (int)targetSpeed, (int)targetSpeed * 4, (int)targetSpeed * 4);// , Config.AddSpeed, Config.DelSpeed);
}
public void SuddenStop()
{
AxisManager.SuddenStop(Config.DeviceName, Config.GetAxisValue());
}
/// <summary>
/// 判断轴运动是否安全
/// </summary>
/// <returns></returns>
public bool IsSafe(int Targetpos,out string msg) {
msg = "";
if (interference == null)
return true;
bool result;
(result,msg) = interference.Invoke(GetAclPosition(), Targetpos);
return !result;
}
#region 匀速上升处理
......
......@@ -8,6 +8,7 @@ using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace DeviceLibrary
......@@ -91,8 +92,15 @@ namespace DeviceLibrary
var y2 = p1.Y + distance * Math.Sin(angle / 180 * Math.PI);
return new Point((int)x2, (int)y2);
}
public static Point CalcLabelPoint(LabelParam labelParam, Point org,int Label_R_Offset, out int labelAngle) {
/// <summary>
///
/// </summary>
/// <param name="labelParam"></param>
/// <param name="org">中心点坐标</param>
/// <param name="Label_R_Offset">贴标臂偏移</param>
/// <param name="labelAngle">贴标角度</param>
/// <returns></returns>
public static Point CalcLabelPoint(LabelParam labelParam, Point org,int Label_R_Offset, int Label_R_Angle_Diff, out int labelAngle) {
SolidBrush blue = new SolidBrush(Color.BlueViolet);
SolidBrush red = new SolidBrush(Color.Red);
......@@ -107,7 +115,7 @@ namespace DeviceLibrary
srcbitmap = new Bitmap(labelParam.bitmapfilename);
}
else {
srcbitmap = new Bitmap(5472,3648);
srcbitmap = new Bitmap(3648, 3648);
}
......@@ -115,8 +123,12 @@ namespace DeviceLibrary
Graphics g = Graphics.FromImage(bitmap);
g.DrawImage(srcbitmap, 0, 0);
int srcbitmap_Width = srcbitmap.Width;
srcbitmap.Dispose();
bitmap.RotateFlip(RotateFlipType.Rotate270FlipNone);
Size pointsize = new Size(30, 30);
int widthOffset = 0;
//Point Right_Batch_Point = new Point(RobotManage.Config.Right_Batch_X, RobotManage.Config.Right_Batch_Y);
......@@ -127,6 +139,11 @@ namespace DeviceLibrary
//Point op = Common.PointRotate(Right_Batch_Point, new Point(c.X, c.Y), 83d / 180 * Math.PI);
//c.X = op.X;
//c.Y = op.Y;
var x = c.Y;
var y = srcbitmap_Width - c.X;
c.X = x;
c.Y = y;
Point op = new Point(c.X, c.Y);
g.FillEllipse(blue, new Rectangle(op, pointsize));
var a = (int)getAngle(Right_Batch_Point, op);
......@@ -154,13 +171,17 @@ namespace DeviceLibrary
bigangles = angles[i];
}
}
if (labelParam.PlateW > 7 && angles.Count==2) {
if (labelParam.PlateW > 7)
{// && angles.Count==2) {
labelAngle = angles[0] + 120;
}
else
{
labelAngle = bigangles + biglen / 2;
}
//匹配照片角度与贴标旋转轴的角度差
labelAngle += Label_R_Angle_Diff;
labelAngle = labelAngle > 360 ? labelAngle- 360 : labelAngle;
//g.FillEllipse(red, new Rectangle(PointRotate(org, op, labelAngle), pointsize));
......@@ -186,6 +207,76 @@ namespace DeviceLibrary
return p3;
}
static IdWorker id = new IdWorker(1, 1);
public static bool codeProcess(LabelParam labelParam) {
List<CodeInfo> newcodeInfos = new List<CodeInfo>();
labelParam.PN = "";
foreach (var ci in labelParam.codeInfos.ToArray())
{
string[] qtyreglist = new string[] {
@"^P([1-9]\d+)$",
@"^(\d+)$%Code 128",
@"^([1-9]\d{7,9})$"
};
foreach (var qtyreg in qtyreglist)
{
var partrules = qtyreg.Split('%');
if (partrules.Length == 2) {
if (ci.CodeType != partrules[1])
break;
}
var m = Regex.Match(ci.CodeStr, partrules[0]);
if (m.Success)
{
newcodeInfos.Add(ci);
//labelParam.codeInfos.Remove(ci);
labelParam.PN = m.Groups[1].Value;
break;
}
}
if (!string.IsNullOrEmpty(labelParam.PN))
break;
}
if (string.IsNullOrEmpty(labelParam.PN))
return false;
labelParam.QTY = 0;
foreach (var ci in labelParam.codeInfos.ToArray())
{
string[] qtyreglist = new string[] {
@"Q(\d{3,5})[^\d]",
@"^Q(\d{3,5})$",
@"\d+"+labelParam.PN+@"[\d\w]+\.\d([1-9]+0+)[1-9]+\d*$",
@"^.+?;.+?;.+?;(\d{3,5}?);.+?;.+?$",
@"^QUANTITY:(\d*)",
@"^(\d{6})\s",
@"\(T\s+(\d{8})\w",
};
foreach (var qtyreg in qtyreglist)
{
var m = Regex.Match(ci.CodeStr, qtyreg);
if (m.Success)
{
newcodeInfos.Add(ci);
//labelParam.codeInfos.Remove(ci);
labelParam.QTY = int.Parse(m.Groups[1].Value);
break;
}
}
if (labelParam.QTY > 0)
break;
}
if (labelParam.QTY == 0)
return false;
// labelParam.QTY=3000;
//labelParam.codeInfos = newcodeInfos;
labelParam.FC = "985022";
labelParam.RI = "AL"+DateTime.Now.ToString("yyMMddHHmmssf");
labelParam.Batch = DateTime.Now.ToString("MMdd");
labelParam.WareCode = labelParam.RI;
LogUtil.info($"匹配成功:{labelParam.PN},{labelParam.QTY},{labelParam.RI}");
return true;
}
public T DeepClone<T>(T _object)
{
T dstobject;
......@@ -236,4 +327,87 @@ namespace DeviceLibrary
warning,
info
}
public class IdWorker
{
private long workerId;
private long datacenterId;
private long sequence = 0L;
private static long twepoch = 1288834974657L;
private static long workerIdBits = 5L;
private static long datacenterIdBits = 5L;
private static long maxWorkerId = -1L ^ (-1L << (int)workerIdBits);
private static long maxDatacenterId = -1L ^ (-1L << (int)datacenterIdBits);
private static long sequenceBits = 12L;
private long workerIdShift = sequenceBits;
private long datacenterIdShift = sequenceBits + workerIdBits;
private long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
private long sequenceMask = -1L ^ (-1L << (int)sequenceBits);
private long lastTimestamp = -1L;
private static object syncRoot = new object();
public IdWorker(long workerId, long datacenterId)
{
// sanity check for workerId
if (workerId > maxWorkerId || workerId < 0)
{
throw new ArgumentException(string.Format("worker Id can't be greater than %d or less than 0", maxWorkerId));
}
if (datacenterId > maxDatacenterId || datacenterId < 0)
{
throw new ArgumentException(string.Format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
}
this.workerId = workerId;
this.datacenterId = datacenterId;
}
public long nextId()
{
lock (syncRoot)
{
long timestamp = timeGen();
if (timestamp < lastTimestamp)
{
throw new ApplicationException(string.Format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
}
if (lastTimestamp == timestamp)
{
sequence = (sequence + 1) & sequenceMask;
if (sequence == 0)
{
timestamp = tilNextMillis(lastTimestamp);
}
}
else
{
sequence = 0L;
}
lastTimestamp = timestamp;
return ((timestamp - twepoch) << (int)timestampLeftShift) | (datacenterId << (int)datacenterIdShift) | (workerId << (int)workerIdShift) | sequence;
}
}
protected long tilNextMillis(long lastTimestamp)
{
long timestamp = timeGen();
while (timestamp <= lastTimestamp)
{
timestamp = timeGen();
}
return timestamp;
}
protected long timeGen()
{
return (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds;
}
}
}
......@@ -9,6 +9,7 @@ using System.Threading.Tasks;
namespace DeviceLibrary
{
[Serializable]
public class LabelParam
{
/// <summary>
......@@ -50,10 +51,40 @@ namespace DeviceLibrary
/// 入料NG消息
/// </summary>
public string NgMsg = "";
/// <summary>
/// 物料编码
/// </summary>
public string PN { get; set; }
/// <summary>
/// 数量
/// </summary>
public int QTY { get; set; } = 0;
/// <summary>
/// 厂家代码
/// </summary>
public string FC { get; set; }
/// <summary>
/// 唯一序列号
/// </summary>
public string RI { get; set; }
/// <summary>
/// 批次号
/// </summary>
public string Batch { get; set; }
public int HeightPos = 0;
public LabelParam clone() {
return this.MemberwiseClone() as LabelParam;
public LabelParam clone()
{
LabelParam dstobject;
using (MemoryStream mStream = new MemoryStream())
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(mStream, this);
mStream.Seek(0, SeekOrigin.Begin);//指定当前流的位置为流的开头。
dstobject = (LabelParam)bf.Deserialize(mStream);
mStream.Close();
}
return dstobject;
}
public string ToStr()
......
......@@ -84,14 +84,18 @@ namespace DeviceLibrary
{
WarnMsg = Name + "[" + MoveInfo.MoveStep + "] 等待(" + io.DisplayStr + "=" + wait.IoValue + ") 超时";
Alarm(AlarmType.IoSingleTimeOut, WarnMsg);
Msg.add(WarnMsg, MsgLevel.warning);
LogUtil.error(WarnMsg, logType + 14);
//MoveInfo.errlog(WarnMsg);
if (!MoveInfo.OneWaitCanEndStep)
if (NoAlarm())
{
isOk = false;
break;
Alarm(AlarmType.IoSingleTimeOut, WarnMsg);
LogUtil.error(WarnMsg, logType + 14);
//MoveInfo.errlog(WarnMsg);
if (!MoveInfo.OneWaitCanEndStep)
{
isOk = false;
break;
}
}
}
}
......
......@@ -45,6 +45,17 @@ namespace DeviceLibrary
LeftMoveInfo.NewMove(MoveStep.L01);
LogUtil.info("IOMonitor:左侧有新料,准备上料");
}
//右侧料串已空
if (RightMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.HIGH) && RightShelfNoTray)
{
Msg.add("右侧料串已空,等待取走料串", MsgLevel.warning);
}
//左侧料串已满
if (LeftMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH) && LeftShelfNoTray)
{
Msg.add("作侧料串已满,等待取走料串", MsgLevel.warning);
}
}
}
}
......@@ -63,6 +63,10 @@ namespace DeviceLibrary
}
break;
case MoveStep.Lbl10:
if (!Label_Y_Axis.IsSafe(Config.Label_Y_P3,out string msg)) {
Msg.add(msg, MsgLevel.warning);
return;
}
//照片中料盘中心点像素位置
Point Right_Batch_Point = new Point(RobotManage.Config.Right_Batch_X, RobotManage.Config.Right_Batch_Y);
//不同尺寸料盘需要在照片上便宜的贴标像素
......@@ -76,15 +80,13 @@ namespace DeviceLibrary
break;
}
//计算照片中贴标的像素位置
Point p = Common.CalcLabelPoint(LabelMoveInfo.MoveParam, Right_Batch_Point, Config.Label_R_Offset, out int labelAngle);
//匹配照片角度与贴标旋转轴的角度差
labelAngle += Config.Label_R_Angle_Diff;
Point p = Common.CalcLabelPoint(LabelMoveInfo.MoveParam, Right_Batch_Point, Config.Label_R_Offset, Config.Label_R_Angle_Diff, out int labelAngle);
labelAngle = labelAngle > 360 ? labelAngle - 360 : labelAngle;
if (labelAngle > 350)
labelAngle = 350;
//计算贴标角度的脉冲值
int labelAxisPos = Config.Label_R_360 / 360 * labelAngle;
int labelAxisPos = Config.Label_R_360 / 350 * labelAngle;
//计算像素点位与中心点的差
Point Label_p3 = new Point(p.X - Right_Batch_Point.X , p.Y - Right_Batch_Point.Y);
//计算像素*脉冲像素比得到脉冲值+中心点基准脉冲
......
......@@ -64,16 +64,23 @@ namespace DeviceLibrary
{
RunningLed.LedState = LedState.on;
//右侧料串已空
if (RightMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.HIGH) && RightShelfNoTray && IOValue(IO_Type.RightCar_Check).Equals(IO_VALUE.HIGH))
RightLed.LedState = LedState.on;
else if (RightMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.HIGH) && RightShelfNoTray)
RightLed.LedState = LedState.blink;
if (RightMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.HIGH) && RightShelfNoTray)
{
//Msg.add("右侧料串已空,等待取走料串",MsgLevel.warning);
if (IOValue(IO_Type.RightCar_Check).Equals(IO_VALUE.HIGH))
RightLed.LedState = LedState.on;
else
RightLed.LedState = LedState.blink;
}
//左侧料串已满
if (LeftMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH) && LeftShelfNoTray && IOValue(IO_Type.LeftCar_Check).Equals(IO_VALUE.HIGH))
LeftLed.LedState = LedState.blink;
else if (LeftMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH) && LeftShelfNoTray)
LeftLed.LedState = LedState.blink;
if (LeftMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.LeftEnd_Check).Equals(IO_VALUE.HIGH) && LeftShelfNoTray)
{
//Msg.add("作侧料串已满,等待取走料串", MsgLevel.warning);
if (IOValue(IO_Type.LeftCar_Check).Equals(IO_VALUE.HIGH))
LeftLed.LedState = LedState.blink;
else
LeftLed.LedState = LedState.blink;
}
}
Led.LedGroup.ForEach((x) => { x.run(); });
}
......
......@@ -14,7 +14,7 @@ namespace DeviceLibrary
bool LeftShelfNoTray = false;
int LeftCount = 0;
public volatile bool SafeReleaseLeftShelf = false;
public bool SafeReleaseLeftShelf = false;
void LeftProcess()
{
if (CheckWait(LeftMoveInfo))
......@@ -62,7 +62,7 @@ namespace DeviceLibrary
}
break;
case MoveStep.L10_WaitReelPut:
Msg.add("左侧等待料盘放入", MsgLevel.info);
Msg.add("左侧空闲中", MsgLevel.info);
break;
case MoveStep.L11_ReelPutted:
LeftCount++;
......
......@@ -28,6 +28,7 @@ namespace DeviceLibrary
electricClamp.Release();
//复制右侧料盘信息
MiddleMoveInfo.MoveParam = RightMoveInfo.MoveParam.clone();
RightMoveInfo.MoveParam = new LabelParam();
MiddleMoveInfo.log("右侧可以取料,旋转轴/上下轴转到P2点");
//MiddleMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.RightArm_Check, IO_VALUE.HIGH));
}
......@@ -114,7 +115,11 @@ namespace DeviceLibrary
}
break;
case MoveStep.M07:
if (LeftMoveInfo.MoveStep == MoveStep.L10_WaitReelPut)
if (!Take_Middle_Axis.IsSafe(Config.Take_Middle_P3,out string msg))
{
Msg.add(msg, MsgLevel.info);
}
else if (LeftMoveInfo.MoveStep == MoveStep.L10_WaitReelPut)
{
MiddleMoveInfo.NextMoveStep(MoveStep.M08);
if (true || electricClamp.IsClamp)
......@@ -123,7 +128,7 @@ namespace DeviceLibrary
MiddleMoveInfo.log("左侧允许放料,旋转轴P3");
//MiddleMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.LeftArm_Check, IO_VALUE.HIGH));
//调用标签打印
DoPrint("123");
DoPrint(MiddleMoveInfo.MoveParam);
}
else
{
......
......@@ -58,19 +58,24 @@ namespace DeviceLibrary
LastPrintStatus = sta;
}
public string LastPrintLabel="";
void StartPrintLabel(string wareCode, string wareCount, string FactoryCode = "")
void StartPrintLabel(LabelParam labelParam)
{
try
{
LastPrintStatus= Asa.PrintLabel.PrinterStatus.Unknown;
LogUtil.info("调用 PrintLabel 打印标签 StartPrintLabel ,[" + wareCode + "] [" + wareCount + "] 开始");
Dictionary<string, string> text = new Dictionary<string, string>();
text.Add("Code", wareCode);
text.Add("Count", wareCount);
text.Add("DateTime", System.DateTime.Now.ToString("F"));
text.Add("FactoryCode", FactoryCode);
LogUtil.info("调用 PrintLabel 打印标签 StartPrintLabel ,[" + labelParam.WareCode + "] [" + labelParam.QTY + "] 开始");
LastPrintLabel = wareCode;
Dictionary<string, string> text = new Dictionary<string, string>
{
{ "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 结束 ");
}
......@@ -80,11 +85,11 @@ namespace DeviceLibrary
}
}
public Task DoPrint(string aaa) {
public Task DoPrint(LabelParam labelParam) {
return Task.Run(() =>
{
StartPrintLabel(aaa, aaa, aaa);
StartPrintLabel(labelParam);
});
}
......
......@@ -50,10 +50,13 @@ namespace DeviceLibrary
case MoveStep.R04:
if (IOValue(IO_Type.RightTop_Check).Equals(IO_VALUE.HIGH) && RightShelfNoTray.Equals(false))
{
RightMoveInfo.NextMoveStep(MoveStep.R06_GettedReelHigh);
GetHeight();
ScanCode();
RightMoveInfo.log($"开始扫码,并获取上一盘料高度,LastHeight={LastHeight}");
if (MiddleMoveInfo.MoveStep >= MoveStep.M09 || MiddleMoveInfo.MoveStep < MoveStep.M02)
{
RightMoveInfo.NextMoveStep(MoveStep.R06_GettedReelHigh);
GetHeight();
ScanCode();
RightMoveInfo.log($"开始扫码,并获取上一盘料高度,LastHeight={LastHeight}");
}
}
else
{
......@@ -88,11 +91,17 @@ namespace DeviceLibrary
}
else
{
RightMoveInfo.MoveParam.IsNg = false;
RightMoveInfo.MoveParam.codeInfos = x;
RightMoveInfo.MoveParam.bitmapfilename = s;
RightMoveInfo.log($"已完成扫码,等待料盘被取走 Count={x.Count}");
if (!Common.codeProcess(RightMoveInfo.MoveParam))
{
RightMoveInfo.log($"未识别到有效码,转入NG箱");
RightMoveInfo.log(JsonHelper.SerializeObject(x));
RightMoveInfo.MoveParam.IsNg = true;
}else
RightMoveInfo.log($"已完成扫码,等待料盘被取走 Count={x.Count}");
}
RightMoveInfo.NextMoveStep(MoveStep.R10_WaitReelLeave);
}
......@@ -232,6 +241,12 @@ namespace DeviceLibrary
return state;
}
public bool IsScanRunning() {
if (RightScanTask == null)
return false;
return !RightScanTask.IsCompleted;
}
/// <summary>
/// 扫码线程
/// </summary>
......@@ -248,15 +263,18 @@ namespace DeviceLibrary
IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
string filename;
Task.Delay(10).Wait();
List<CodeInfo> LastCodeList;
List<CodeInfo> LastCodeList, LastCodeList2;
(LastCodeList, filename) = CodeManager.CameraScan(new List<string> { Config.RightCameraName });
if (LastCodeList.Count <= 0)
LabelParam labelParam = new LabelParam();
labelParam.codeInfos = new List<CodeInfo>(LastCodeList);
if (!Common.codeProcess(labelParam))
{
Task.Delay(500).Wait();
(LastCodeList, filename) = CodeManager.CameraScan(new List<string> { Config.RightCameraName });
(LastCodeList2, filename) = CodeManager.CameraScan(new List<string> { Config.RightCameraName });
LastCodeList.AddRange(LastCodeList2);
}
IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
//IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
return (LastCodeList, filename);
}));
......
......@@ -100,6 +100,9 @@ namespace DeviceLibrary
Label_Z_Axis = new AxisBean(Config.Label_Z_Axis, Name);
Label_R_Axis = new AxisBean(Config.Label_R_Axis, Name);
#endregion
Label_Y_Axis.interference += Label_Y_Axis_interference;
Take_Middle_Axis.interference += Take_Middle_Axis_interference;
electricClamp = RobotManage.electricGripper;
AlarmBuzzer.SetOnOffAction(() =>{ IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.HIGH); }, () => { IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.LOW); });
......@@ -107,6 +110,35 @@ namespace DeviceLibrary
InitPrint();
LedProcessInit();
}
private (bool,string) Take_Middle_Axis_interference(int from, int to)
{
if (to > from)
{
if (Label_Y_Axis.GetAclPosition() > Config.Label_Y_P2 + Label_Y_Axis.Config.CanErrorCountMax)
{
return (true,"可能与贴标Y轴干涉");
}
}
return (false,"");
}
private (bool, string) Label_Y_Axis_interference(int from, int to)
{
if (to > from)
{
if (Take_Middle_Axis.GetAclPosition() > Math.Max(Config.Take_Middle_P1, Config.Take_Middle_P2) + Take_Middle_Axis.Config.CanErrorCountMax) {
return (true, "可能与旋转轴干涉"); ;
}
}
var Label_Z_Pos = Label_Z_Axis.GetAclPosition();
if (Label_Z_Pos>Math.Max(Config.Label_Z_P2,Config.Label_Z_P4)+ Label_Z_Axis.Config.CanErrorCountMax)
return (true, "可能与贴标Z轴干涉"); ;
return (false, "");
}
/// <summary>
/// 整机启动变量,设置为false后将退出线程,只在停止时调用
/// </summary>
......@@ -141,6 +173,7 @@ namespace DeviceLibrary
catch (Exception ex)
{
Msg.add(ex.ToString(), MsgLevel.warning);
Msg.setlogones();
}
finally {
ProcessMsgEvent?.Invoke(Msg.get());
......@@ -183,13 +216,13 @@ namespace DeviceLibrary
ResetMoveInfo.NextMoveStep(MoveStep.H02_HomeReset);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
ResetMoveInfo.log("正在回原");
SafeReleaseLeftShelf = false;
Label_Z_Axis.HomeMove(ResetMoveInfo);
Left_Batch_Axis.HomeMove(ResetMoveInfo);
Right_Batch_Axis.HomeMove(ResetMoveInfo);
electricClamp.HomeReset();
break;
case MoveStep.H02_HomeReset:
case MoveStep.H02_HomeReset :
ResetMoveInfo.NextMoveStep(MoveStep.H03_HomeReset);
Label_R_Axis.HomeMove(ResetMoveInfo);
ResetMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
......@@ -260,8 +293,7 @@ namespace DeviceLibrary
Msg.add("用户暂停", MsgLevel.warning);
DeviceSuddenStop();
ok = false;
}
if (IOValue(IO_Type.GratingSignal_Check).Equals(IO_VALUE.LOW))
}else if (IOValue(IO_Type.GratingSignal_Check).Equals(IO_VALUE.LOW))
{
if (!IgnoreSafecheck && !IgnoreGratingSignal
&& IOValue(IO_Type.RightCar_Check).Equals(IO_VALUE.LOW)
......@@ -270,8 +302,8 @@ namespace DeviceLibrary
ok = false;
DeviceSuddenStop();
}
Msg.add("安全光栅被遮挡"+(ok?"[已忽略]":""), MsgLevel.warning);
Msg.add("安全光栅被遮挡" + (ok ? "[已忽略]" : ""), MsgLevel.warning);
}
if (IOValue(IO_Type.HasNgBox).Equals(IO_VALUE.LOW))
{
......@@ -294,7 +326,6 @@ namespace DeviceLibrary
}
if (IOValue(IO_Type.RightBackDoor_Check).Equals(IO_VALUE.LOW))
{
if (!IgnoreSafecheck)
{
ok = false;
......@@ -380,7 +411,5 @@ namespace DeviceLibrary
return ok;
}
}
}
......@@ -6,6 +6,7 @@ using System.Threading.Tasks;
namespace DeviceLibrary
{
public enum MoveStep
{
Wait,
......
......@@ -50,6 +50,7 @@ namespace DeviceLibrary
msg += "IO板卡初始化失败\n";
}
IOManager.IOMove(IO_Type.Device_Led, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
LoadFinishEvent?.Invoke(IsDebug?IsDebug:IsLoadOk, msg);
}
......
类型,分类编号,说明,名称,属性值,设备名称,电器定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位
AXIS,,进料提升轴,Right_Batch_Axis,0,HC,,40000,130000,130000,2000,20000,80000,10,100,0,0
AXIS,,出料提升轴,Left_Batch_Axis,1,HC,,40000,130000,130000,2000,20000,80000,10,100,0,0
AXIS,,取料升降轴,Take_UpDown_Axis,2,HC,,40000,130000,130000,1000,4000,15000,10,100,0,0
AXIS,,取料旋转轴,Take_Middle_Axis,3,HC,,1000,10000,10000,500,3000,7000,10,100,0,0
AXIS,,贴标移栽机构X轴,Label_X_Axis,4,HC,,90000,1000000,1000000,3000,30000,100000,10,100,0,0
AXIS,,贴标移栽机构Y轴,Label_Y_Axis,5,HC,,90000,1000000,1000000,3000,30000,100000,10,100,0,0
AXIS,,贴标移栽机构Z轴,Label_Z_Axis,6,HC,,90000,1000000,1000000,2000,10000,40000,10,100,0,0
AXIS,,贴标移栽机构R轴,Label_R_Axis,7,HC,,700,2100,2100,20,350,5000,500,100,0,0
AXIS,,进料提升轴,Right_Batch_Axis,0,HC,,40000,200000,200000,2000,20000,80000,10,300,0,0
AXIS,,出料提升轴,Left_Batch_Axis,1,HC,,40000,200000,200000,2000,20000,80000,10,300,0,0
AXIS,,取料升降轴,Take_UpDown_Axis,2,HC,,40000,200000,200000,1000,4000,15000,10,300,0,0
AXIS,,取料旋转轴,Take_Middle_Axis,3,HC,,1000,18000,18000,500,3000,7000,10,1000,0,0
AXIS,,贴标移栽机构X轴,Label_X_Axis,5,HC,,90000,1500000,1500000,3000,30000,100000,10,1000,0,0
AXIS,,贴标移栽机构Y轴,Label_Y_Axis,4,HC,,90000,1500000,1500000,3000,30000,100000,10,1000,0,0
AXIS,,贴标移栽机构Z轴,Label_Z_Axis,6,HC,,90000,1500000,1500000,2000,10000,40000,10,100,0,0
AXIS,,贴标移栽机构R轴,Label_R_Axis,7,HC,,700,3000,3000,20,350,5000,500,100,0,0
,,,,,,,,,,,,,,,,
PRO,0,IO信号超时时间(秒),IOSingle_TimerOut,15,,,,,,,,,,,,
PRO,0,气压检测超时,AirCheckSeconds,5,,,,,,,,,,,,
PRO,30,右侧提升轴每毫米脉冲,Right_Batch_ChangeValue,5555,,,,,,,,,,,,
PRO,30,左侧提升轴每毫米脉冲,Left_Batch_ChangeValue,5555,,,,,,,,,,,,
PRO,0,右侧提升轴每毫米脉冲,Right_Batch_ChangeValue,5555,,,,,,,,,,,,
PRO,0,左侧提升轴每毫米脉冲,Left_Batch_ChangeValue,5555,,,,,,,,,,,,
PRO,30,右侧相机名称,RightCameraName,GigE:MV-CE200-10GC (00E78064919),,,,,,,,,,,,
PRO,30,右侧轴心坐标X,Right_Batch_X,222,,,,,,,,,,,,
PRO,30,右侧轴心坐标Y,Right_Batch_Y,333,,,,,,,,,,,,
PRO,30,贴标R轴0位角度差,Label_R_Angle_Diff,0,,,,,,,,,,,,
PRO,30,贴标R轴偏置距离像素,Label_R_Offset,0,,,,,,,,,,,,
PRO,30,贴标R轴360度脉冲,Label_R_360,7031,,,,,,,,,,,,
PRO,30,右侧轴心坐标X,Right_Batch_X,1757,,,,,,,,,,,,
PRO,30,右侧轴心坐标Y,Right_Batch_Y,1945,,,,,,,,,,,,
PRO,30,贴标R轴0位角度差,Label_R_Angle_Diff,85,,,,,,,,,,,,
PRO,30,贴标R轴偏置距离像素,Label_R_Offset,750,,,,,,,,,,,,
PRO,30,贴标R轴360度脉冲,Label_R_360,7000,,,,,,,,,,,,
PRO,0,贴标X轴基准点,Label_X_Base,8,,,,,,,,,,,,
PRO,0,贴标Y轴基准点,Label_Y_Base,7,,,,,,,,,,,,
PRO,30,图像/X轴比值,Cam_Pixel_X_Ratio,6,,,,,,,,,,,,
PRO,30,图像/Y轴比值,Cam_Pixel_Y_Ratio,5,,,,,,,,,,,,
PRO,30,像素偏离位置7寸,Label_Offset_Pixel_7,200,,,,,,,,,,,,
PRO,30,像素偏离位置13寸,Label_Offset_Pixel_13,200,,,,,,,,,,,,
PRO,30,像素偏离位置15寸,Label_Offset_Pixel_15,200,,,,,,,,,,,,
PRO,30,图像/X轴比值,Cam_Pixel_X_Ratio,90,,,,,,,,,,,,
PRO,30,图像/Y轴比值,Cam_Pixel_Y_Ratio,90,,,,,,,,,,,,
PRO,0,像素偏离位置7寸,Label_Offset_Pixel_7,200,,,,,,,,,,,,
PRO,0,像素偏离位置13寸,Label_Offset_Pixel_13,200,,,,,,,,,,,,
PRO,0,像素偏离位置15寸,Label_Offset_Pixel_15,200,,,,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,13,取料旋转轴待机点P1,Take_Middle_P1,22888,,,3000,,,,,,,,,
PRO,13,取料旋转轴右取料点P2,Take_Middle_P2,16979,,,3000,,,,,,,,,
PRO,13,取料旋转轴左取料点P3,Take_Middle_P3,28948,,,3000,,,,,,,,,
PRO,13,取料旋转轴NG放料点P5,Take_Middle_P5,1036,,,3000,,,,,,,,,
PRO,13,取料旋转轴待机点P1,Take_Middle_P1,22500,,,8000,,,,,,,,,
PRO,13,取料旋转轴右取料点P2,Take_Middle_P2,16800,,,8000,,,,,,,,,
PRO,13,取料旋转轴左取料点P3,Take_Middle_P3,28600,,,8000,,,,,,,,,
PRO,13,取料旋转轴NG放料点P5,Take_Middle_P5,1036,,,8000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,12,取料升降轴待机点P1,Take_UpDown_P1,10,,,50000,,,,,,,,,
PRO,12,取料升降轴取料高点P2,Take_UpDown_P2,10,,,50000,,,,,,,,,
PRO,12,取料升降轴取右料低点P3,Take_UpDown_P3,195734,,,50000,,,,,,,,,
PRO,12,取料升降轴取左料低点P4,Take_UpDown_P4,190738,,,50000,,,,,,,,,
PRO,12,取料升降轴NG放料点P5,Take_UpDown_P5,165312,,,30000,,,,,,,,,
PRO,12,取料升降轴待机点P1,Take_UpDown_P1,1000,,,65000,,,,,,,,,
PRO,12,取料升降轴取料高点P2,Take_UpDown_P2,60000,,,130000,,,,,,,,,
PRO,12,取料升降轴取右料低点P3,Take_UpDown_P3,194800,,,80000,,,,,,,,,
PRO,12,取料升降轴取左料低点P4,Take_UpDown_P4,196600,,,80000,,,,,,,,,
PRO,12,取料升降轴NG放料点P5,Take_UpDown_P5,165312,,,80000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,10,进料升轴低点P1,Right_Batch_P1,5,,,16000,,,,,,,,,
PRO,10,进料升轴高点P2,Right_Batch_P2,891747,,,16000,,,,,,,,,
PRO,11,出料升轴低点P1,Left_Batch_P1,5,,,16000,,,,,,,,,
PRO,11,出料升轴高点P2,Left_Batch_P2,891747,,,16000,,,,,,,,,
PRO,10,进料升轴低点P1,Right_Batch_P1,1000,,,36000,,,,,,,,,
PRO,10,进料升轴高点P2,Right_Batch_P2,1056432,,,36000,,,,,,,,,
PRO,11,出料升轴低点P1,Left_Batch_P1,5,,,36000,,,,,,,,,
PRO,11,出料升轴高点P2,Left_Batch_P2,1013000,,,36000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,14,贴标X轴待机点P1,Label_X_P1,5,,,90000,,,,,,,,,
PRO,14,贴标X轴取标点P2,Label_X_P2,10500,,,90000,,,,,,,,,
PRO,14,贴标X轴贴标基准点P3,Label_X_P3,508371,,,90000,,,,,,,,,
PRO,15,贴标X轴待机点P1,Label_X_P1,5,,,95000,,,,,,,,,
PRO,15,贴标X轴取标点P2,Label_X_P2,80942,,,190000,,,,,,,,,
PRO,15,贴标X轴贴标基准点P3,Label_X_P3,96035,,,190000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,15,贴标Y轴待机点P1,Label_Y_P1,5,,,90000,,,,,,,,,
PRO,15,贴标Y轴取标点P2,Label_Y_P2,80942,,,90000,,,,,,,,,
PRO,15,贴标Y轴贴标基准点P3,Label_Y_P3,96438,,,90000,,,,,,,,,
PRO,14,贴标Y轴待机点P1,Label_Y_P1,5,,,200000,,,,,,,,,
PRO,14,贴标Y轴取标点P2,Label_Y_P2,11500,,,400000,,,,,,,,,
PRO,14,贴标Y轴贴标基准点P3,Label_Y_P3,503303,,,400000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,16,贴标Z轴待机点P1,Label_Z_P1,5,,,90000,,,,,,,,,
PRO,16,贴标Z轴取标前点P2,Label_Z_P2,5,,,90000,,,,,,,,,
PRO,16,贴标Z轴取标点P3,Label_Z_P3,113000,,,90000,,,,,,,,,
PRO,16,贴标Z轴贴标前点P4,Label_Z_P4,5,,,90000,,,,,,,,,
PRO,16,贴标Z轴贴标点P5,Label_Z_P5,142804,,,90000,,,,,,,,,
PRO,16,贴标Z轴待机点P1,Label_Z_P1,5,,,50000,,,,,,,,,
PRO,16,贴标Z轴取标前点P2,Label_Z_P2,5,,,100000,,,,,,,,,
PRO,16,贴标Z轴取标点P3,Label_Z_P3,111300,,,100000,,,,,,,,,
PRO,16,贴标Z轴贴标前点P4,Label_Z_P4,5,,,100000,,,,,,,,,
PRO,16,贴标Z轴贴标点P5,Label_Z_P5,135100,,,100000,,,,,,,,,
,,,,,,,,,,,,,,,,
PRO,17,贴标R轴待机点P1,Label_R_P1,0,,,700,,,,,,,,,
PRO,17,贴标R轴取标点P2,Label_R_P2,1715,,,700,,,,,,,,,
PRO,17,贴标R轴待机点P1,Label_R_P1,55,,,700,,,,,,,,,
PRO,17,贴标R轴取标点P2,Label_R_P2,1715,,,1400,,,,,,,,,
,,,,,,,,,,,,,,,,
DI,0,急停,SuddenStop_BTN,0,HC,X00,,,,,,,,,,
DI,0,进料口确认按钮,Right_BTN,1,HC,X01,,,,,,,,,,
......
<?xml version="1.0" encoding="UTF-8"?>
<config ver="10">
<item key="App_Title" ver="10" value="自动贴标机" />
<item key="PrinterName" ver="10" value="Microsoft Print to PDF" />
<item key="PrinterName" ver="10" value="ZDesigner GT800-300dpi EPL" />
<item key="LabelName" ver="10" value="457" />
<item key="AngleChange " ver="10" value="83" />
<item key="ElectricGripperPort" ver="10" value="COM12" />
<item key="ElectricGripperPushForce" ver="10" value="70" />
<item key="EnableBuzzer" ver="10" value="False" />
</config>
\ No newline at end of file
......@@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DeviceLibrary</RootNamespace>
<AssemblyName>DeviceLibrary</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
......@@ -52,12 +53,15 @@
<Reference Include="Neotel.Rmaxis">
<HintPath>..\..\增广夹爪\Rmaxis\bin\Debug\Neotel.Rmaxis.dll</HintPath>
</Reference>
<Reference Include="SdkApi.Core">
<HintPath>..\..\LinkOS-PC-Samples-ZSDK_DevDemos_.NET\Source\Sdk\SdkApi.Core.dll</HintPath>
</Reference>
<Reference Include="SdkApi.Desktop">
<HintPath>..\..\LinkOS-PC-Samples-ZSDK_DevDemos_.NET\Source\Sdk\SdkApi.Desktop.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
......@@ -94,6 +98,7 @@
<Compile Include="DeviceLibrary\HC\HCIOManager.cs" />
<Compile Include="DeviceLibrary\I_IOManager.cs" />
<Compile Include="DeviceLibrary\IOManager.cs" />
<Compile Include="DeviceLibrary\ZebraPrinter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="userControl\AxisMoveControl.cs">
<SubType>UserControl</SubType>
......@@ -101,11 +106,20 @@
<Compile Include="userControl\AxisMoveControl.Designer.cs">
<DependentUpon>AxisMoveControl.cs</DependentUpon>
</Compile>
<Compile Include="userControl\AxisTipControl.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="userControl\AxisTipControl.Designer.cs">
<DependentUpon>AxisTipControl.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="userControl\AxisMoveControl.resx">
<DependentUpon>AxisMoveControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="userControl\AxisTipControl.resx">
<DependentUpon>AxisTipControl.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj">
......@@ -119,10 +133,11 @@
</ItemGroup>
<ItemGroup>
<Content Include="Config\Config.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Config\general.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
......
......@@ -12,19 +12,27 @@ namespace DeviceLibrary
static on ondelegate;
static on offdelegate;
static bool enable = false;
public static bool Enable { get => enable;set {
public static bool Enable
{
get => enable; set
{
enable = value;
if (!value) {
if (!value)
{
OFF();
}
} }
}
}
static AlarmBuzzerState State = AlarmBuzzerState.OFF;
public static event EventHandler<bool> BuzzerStateChange;
public static void SetOnOffAction(Action ona, Action offa) {
public static void SetOnOffAction(Action ona, Action offa)
{
ondelegate = new on(ona);
offdelegate = new on(offa);
}
public static void ON(bool force=false) {
public static void ON(bool force = false)
{
if (!Enable)
return;
......@@ -32,14 +40,16 @@ namespace DeviceLibrary
if (force || (State != AlarmBuzzerState.ON && State != AlarmBuzzerState.MuteOnce))
{
State = AlarmBuzzerState.ON;
ondelegate();
ondelegate?.Invoke();
BuzzerStateChange?.Invoke(null, true);
}
}
public static void OFF()
{
if (State == AlarmBuzzerState.OFF)
return;
State = AlarmBuzzerState.OFF;
offdelegate();
offdelegate?.Invoke();
BuzzerStateChange?.Invoke(null, false);
}
public static void MuteOnce()
......@@ -47,7 +57,7 @@ namespace DeviceLibrary
if (State == AlarmBuzzerState.ON)
{
State = AlarmBuzzerState.MuteOnce;
offdelegate();
offdelegate?.Invoke();
BuzzerStateChange?.Invoke(null, false);
}
}
......
......@@ -17,9 +17,8 @@ namespace DeviceLibrary
{
public class CodeManager
{
//public static int DeCodeType = ConfigAppSettings.GetIntValue(Setting_Init.DeCodeType);
public static string CodeType = ConfigAppSettings.GetValue(Setting_Init.CodeType);
//private static int QRCodeCount = ConfigAppSettings.GetIntValue(Setting_Init.QRCodeCount);
private static int QRCodeCount = ConfigAppSettings.GetIntValue(Setting_Init.QRCodeCount);
public static List<string> cameraNameList = new List<string>();
public static List<string> codeTypeList = new List<string>();
public static List<string> hikNameList = new List<string>();
......@@ -153,7 +152,7 @@ namespace DeviceLibrary
Bitmap bmp = null;
try
{
bool nohalcon = true;
bool nohalcon = false;
ho_Image = Camera._cam.CaptureOnImage(cameraName, out bmp, nohalcon);
//HalconDotNet.HOperatorSet.RotateImage()
if (ho_Image == null && !nohalcon)
......@@ -165,27 +164,57 @@ namespace DeviceLibrary
LogUtil.info(" 【" + cameraName + "】取图片完成,开始扫码");
string r = "";
bmp.RotateFlip(RotateFlipType.Rotate270FlipNone);
List<CodeInfo> tlci = EyemDecode2.Decoder(ref bmp);
//bmp.RotateFlip(RotateFlipType.Rotate270FlipNone);
//List<CodeInfo> tlci = EyemDecode2.Decoder(ref bmp);
foreach (CodeInfo code in tlci)
//foreach (CodeInfo code in tlci)
//{
// 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)
{
LogUtil.info(" 【" + cameraName + "】[eyemDecode]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr);
//string str = CodeManager.ReplaceCode(code.CodeStr);
lock (codeList)
//判断是否是一维码
if (codeType.ToLower().Equals("barcode"))
{
cc = HDCodeHelper.DecodeBarCode(ho_Image);
}
else
{
cc = HDCodeHelper.DecodeCode(ho_Image, codeType, GetCodeParamFilePath(codeType), QRCodeCount, 3000);
cc.ForEach((x) => { x.CodeType = codeType; });
}
LogUtil.info(" 【" + cameraName + "】[Halcon]" + codeType + "," + QRCodeCount + "," + cc.Count);
foreach (CodeInfo c in cc)
{
if (!codeList.Contains(code))
LogUtil.info(" 【" + cameraName + "】[Halcon]" + c.CodeType + "(X: " + c.X + ",Y: " + c.Y + ") " + c.CodeStr);
c.CodeStr = CodeManager.ReplaceCode(c.CodeStr);
lock (codeList)
{
codeList.Add(code);
r = r + "##" + code.CodeStr;
if (!codeList.Contains(c))
{
codeList.Add(c);
r = r + "##" + c.CodeStr;
}
}
}
}
//if (codeList.Count() == 0)
//{
bitmapfilename=SaveImageToFile("mimo", cameraName, bmp);
//}
bitmapfilename =SaveImageToFile("mimo", cameraName, bmp);
// }
LogUtil.info(" 【" + cameraName + "】" + " 扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】 :" + r);
}
catch (AccessViolationException e)
......@@ -222,6 +251,19 @@ namespace DeviceLibrary
}
return (codeList,bitmapfilename);
}
/// <summary>
///
/// </summary>
/// <param name="imgWidth"></param>
/// <param name="imgHeight"></param>
/// <param name="pX"></param>
/// <param name="pY"></param>
/// <returns>x,y</returns>
static (int, int) PointRoate270(int imgWidth, int imgHeight, int pX, int pY) {
int x = pY;
int y = imgWidth - pX;
return (x, y);
}
private static string SaveImageToFile(string deviceName, string cameraName, Bitmap bitmap)
{
string date = DateTime.Now.ToString("HH-mm-ss-") + DateTime.Now.Millisecond;
......@@ -236,7 +278,7 @@ namespace DeviceLibrary
}
bit.Save(dire + iamgeName, ImageFormat.Bmp);
bit.Dispose();
LogUtil.info(deviceName + " 【" + cameraName + "】扫码失败,保存图片到【" + dire + iamgeName + "】成功");
LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成,保存图片到【" + dire + iamgeName + "】成功");
}
catch (Exception ex)
......
......@@ -22,7 +22,11 @@ namespace DeviceLibrary
}
public void ClosePort()
{
axis.ClosePort();
try
{
axis.ClosePort();
}
catch { }
}
public bool Clamp(MoveInfo moveInfo = null)
{
......@@ -67,8 +71,8 @@ namespace DeviceLibrary
public void HomeReset(MoveInfo moveInfo = null)
{
GripperType = GripperTypeE.Reset;
//if (!IsBusy)
//{
ClosePort();
OpenPort(ConfigHelper.Config.Get("ElectricGripperPort"));
axis.ResetError();
axis.GoHome();
clampTimes = 0;
......
......@@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary.IO
......@@ -28,9 +29,15 @@ namespace OnlineStore.DeviceLibrary.IO
if (!HCBoardManager.CardInitOk())
{
HCBoardManager.InitConfig("", "", "HCBOARD");
return HCBoardManager.OpenCard();
if (!HCBoardManager.OpenCard())
{
LogUtil.info("板卡第一次打开失败,关闭后重新打开");
HCBoardManager.CloseCard();
Thread.Sleep(2000);
return HCBoardManager.OpenCard();
}
}
return false;
return true;
}
public IO_VALUE GetDIValue(string deviceName, byte slaveID, ushort index)
......
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Printer;
namespace DeviceLibrary
{
class ZebraPrinter
{
Connection printerConnection;
/// <summary>
///
/// </summary>
/// <param name="printname">"ZDesigner ZD420-300dpi ZPL"</param>
public ZebraPrinter(string printname) {
printerConnection = new DriverPrinterConnection(printname);
//Open();
}
~ZebraPrinter()
{
Close();
}
public bool Open(out string msg) {
bool rtn = false;
msg = "";
if (!printerConnection.Connected)
{
try
{
printerConnection.Open();
rtn = true;
}
catch (ConnectionException e)
{
msg = "Connection Error:" + e.Message;
}
catch (IOException e)
{
msg = "IO Error:" + e.Message;
}
catch (ZebraPrinterLanguageUnknownException e)
{
msg = "Connection Error:" + e.Message;
}
catch (Exception e)
{
msg = "Error:" + e.Message;
}
}
else {
rtn = true;
}
if (!string.IsNullOrEmpty(msg))
log(msg);
return rtn;
}
void log(string msg) {
LogUtil.info("ZebraPrinter: " + msg);
}
public void Close() {
if (printerConnection != null)
printerConnection.Close();
}
public bool HasLabel
{
get {
Open(out _);
string d = "! U1 getvar \"sensor.peeler\"\n";
var b = Encoding.ASCII.GetBytes(d);
var rd = printerConnection.SendAndWaitForResponse(b, 5000, 500, null);
var rs = Encoding.ASCII.GetString(rd);
log("sensor.peeler" + rs);
return rs.IndexOf("not clear") > -1;
}
}
public bool HasPaper
{
get
{
Open(out _);
string d = "! U1 getvar \"sensor.paper_supply\"\n";
var b = Encoding.ASCII.GetBytes(d);
var rd = printerConnection.SendAndWaitForResponse(b, 5000, 500, null);
var rs = Encoding.ASCII.GetString(rd);
log("sensor.paper_supply:"+rs);
return rs.IndexOf("ok") > -1;
}
}
bool Cover_Open
{
get
{
Open(out _);
string d = "! U1 getvar \"sensor.cover_open\"\n";
var b = Encoding.ASCII.GetBytes(d);
var rd = printerConnection.SendAndWaitForResponse(b, 5000, 500, null);
var rs = Encoding.ASCII.GetString(rd);
log("sensor.cover_open:" + rs);
return rs.IndexOf("yes") > -1;
}
}
void test()
{
Connection printerConnection = null;
try
{
printerConnection = new DriverPrinterConnection("ZDesigner ZD420-300dpi ZPL");
//var dp= new DriverPrinterConnection("ZD420 / Text Only");
//printerConnection = connectionSelector.GetConnection();
printerConnection.Open();
string d = "~PH";
//string d = "! U1 getvar \"sensor.peeler\"";
// d = @"^XA
//^FO100,100^BY3
//^B1N,N,150,Y,N
//^FD123456^FS
//^XZ
//";
//var b = Encoding.ASCII.GetBytes(d);
//printerConnection.Write(b);
//var rd = printerConnection.SendAndWaitForResponse(b, 5 * 1000, 5 * 1000,null);
//var rd = printerConnection.SendAndWaitForResponse(b, 5 * 1000, 5 * 1000,null);
//printerConnection.WaitForData(100*1000);
//var rd = printerConnection.Read();
//Console.WriteLine("Response:"+Encoding.ASCII.GetString(rd));
return;
}
catch (ConnectionException e)
{
//MessageBoxCreator.ShowError(e.Message, "Connection Error");
}
catch (IOException e)
{
//MessageBoxCreator.ShowError(e.Message, "IO Error");
}
catch (ZebraPrinterLanguageUnknownException e)
{
//MessageBoxCreator.ShowError(e.Message, "Connection Error");
}
catch (Exception e)
{
//MessageBoxCreator.ShowError(e.Message, "Send File Error");
}
finally
{
try
{
if (printerConnection != null)
printerConnection.Close();
}
catch (ConnectionException) { }
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" requireReinstallation="true" />
</packages>
\ No newline at end of file
......@@ -31,6 +31,7 @@
this.components = new System.ComponentModel.Container();
this.groupAxis = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.lblAlarmcode = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.lblhomeSts = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
......@@ -99,7 +100,6 @@
this.txtAxisDeviceName = new System.Windows.Forms.TextBox();
this.lblServerOn = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.lblAlarmcode = new System.Windows.Forms.Label();
this.groupAxis.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
......@@ -159,6 +159,17 @@
this.groupBox2.TabStop = false;
this.groupBox2.Text = "轴状态监控";
//
// lblAlarmcode
//
this.lblAlarmcode.AutoSize = true;
this.lblAlarmcode.Location = new System.Drawing.Point(433, 65);
this.lblAlarmcode.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblAlarmcode.Name = "lblAlarmcode";
this.lblAlarmcode.Size = new System.Drawing.Size(68, 17);
this.lblAlarmcode.TabIndex = 19;
this.lblAlarmcode.Text = "错误码:160";
this.lblAlarmcode.Visible = false;
//
// label4
//
this.label4.AutoSize = true;
......@@ -667,7 +678,7 @@
this.btnDelMove.Name = "btnDelMove";
this.btnDelMove.Size = new System.Drawing.Size(140, 45);
this.btnDelMove.TabIndex = 332;
this.btnDelMove.Text = "点动-(上升)";
this.btnDelMove.Text = "点动-";
this.btnDelMove.UseVisualStyleBackColor = false;
this.btnDelMove.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnDelMove_MouseDown);
this.btnDelMove.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btnDelMove_MouseUp);
......@@ -713,7 +724,7 @@
this.btnAddMove.Name = "btnAddMove";
this.btnAddMove.Size = new System.Drawing.Size(140, 45);
this.btnAddMove.TabIndex = 330;
this.btnAddMove.Text = "点动+(上升)";
this.btnAddMove.Text = "点动+";
this.btnAddMove.UseVisualStyleBackColor = false;
this.btnAddMove.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnAddMove_MouseDown);
this.btnAddMove.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btnAddMove_MouseUp);
......@@ -941,17 +952,6 @@
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// lblAlarmcode
//
this.lblAlarmcode.AutoSize = true;
this.lblAlarmcode.Location = new System.Drawing.Point(433, 65);
this.lblAlarmcode.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblAlarmcode.Name = "lblAlarmcode";
this.lblAlarmcode.Size = new System.Drawing.Size(68, 17);
this.lblAlarmcode.TabIndex = 19;
this.lblAlarmcode.Text = "错误码:160";
this.lblAlarmcode.Visible = false;
//
// AxisMoveControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
......
......@@ -93,7 +93,7 @@ namespace DeviceLibrary
int position = FormUtil.GetIntValue(txtAPosition);
int speed = FormUtil.GetIntValue(txtASpeed);
LogUtil.info(boxBean.Name+"点击【绝对运动】,【" + PortName + "_" + SlvAddr + "】位置【" + position + "】速度【" + speed + "】");
AxisManager.AbsMove(PortName, SlvAddr, position, speed,axis.AddSpeed,axis.DelSpeed);
AxisManager.AbsMove(PortName, SlvAddr, position, speed, speed * 4, speed * 4);//,axis.AddSpeed,axis.DelSpeed);
}
private void btnAxisRMove_Click(object sender, EventArgs e)
......

partial class AxisTipControl
{
/// <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.comjSpeed = new System.Windows.Forms.ComboBox();
this.btnDelMove = new System.Windows.Forms.Button();
this.btnAddMove = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.textBox_pos = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.btn_ok = new System.Windows.Forms.Button();
this.btn_cancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// comjSpeed
//
this.comjSpeed.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comjSpeed.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.comjSpeed.FormattingEnabled = true;
this.comjSpeed.Location = new System.Drawing.Point(58, 5);
this.comjSpeed.Name = "comjSpeed";
this.comjSpeed.Size = new System.Drawing.Size(81, 28);
this.comjSpeed.TabIndex = 339;
//
// btnDelMove
//
this.btnDelMove.BackColor = System.Drawing.Color.White;
this.btnDelMove.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDelMove.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDelMove.Location = new System.Drawing.Point(155, 39);
this.btnDelMove.Name = "btnDelMove";
this.btnDelMove.Size = new System.Drawing.Size(116, 45);
this.btnDelMove.TabIndex = 338;
this.btnDelMove.Text = "点动-";
this.btnDelMove.UseVisualStyleBackColor = false;
this.btnDelMove.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnDelMove_MouseDown);
this.btnDelMove.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btnDelMove_MouseUp);
//
// btnAddMove
//
this.btnAddMove.BackColor = System.Drawing.Color.White;
this.btnAddMove.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAddMove.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnAddMove.Location = new System.Drawing.Point(14, 39);
this.btnAddMove.Name = "btnAddMove";
this.btnAddMove.Size = new System.Drawing.Size(116, 45);
this.btnAddMove.TabIndex = 337;
this.btnAddMove.Text = "点动+";
this.btnAddMove.UseVisualStyleBackColor = false;
this.btnAddMove.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnAddMove_MouseDown);
this.btnAddMove.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btnAddMove_MouseUp);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(11, 14);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 12);
this.label1.TabIndex = 336;
this.label1.Text = "速度:";
//
// textBox_pos
//
this.textBox_pos.Location = new System.Drawing.Point(74, 97);
this.textBox_pos.Name = "textBox_pos";
this.textBox_pos.Size = new System.Drawing.Size(100, 21);
this.textBox_pos.TabIndex = 340;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(14, 100);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 12);
this.label2.TabIndex = 336;
this.label2.Text = "当前位置:";
//
// btn_ok
//
this.btn_ok.Location = new System.Drawing.Point(181, 123);
this.btn_ok.Name = "btn_ok";
this.btn_ok.Size = new System.Drawing.Size(90, 33);
this.btn_ok.TabIndex = 341;
this.btn_ok.Text = "确定";
this.btn_ok.UseVisualStyleBackColor = true;
this.btn_ok.Click += new System.EventHandler(this.btn_ok_Click);
//
// btn_cancel
//
this.btn_cancel.Location = new System.Drawing.Point(16, 123);
this.btn_cancel.Name = "btn_cancel";
this.btn_cancel.Size = new System.Drawing.Size(90, 33);
this.btn_cancel.TabIndex = 341;
this.btn_cancel.Text = "取消";
this.btn_cancel.UseVisualStyleBackColor = true;
this.btn_cancel.Click += new System.EventHandler(this.btn_cancel_Click);
//
// AxisTipControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(293, 166);
this.Controls.Add(this.btn_cancel);
this.Controls.Add(this.btn_ok);
this.Controls.Add(this.textBox_pos);
this.Controls.Add(this.comjSpeed);
this.Controls.Add(this.btnDelMove);
this.Controls.Add(this.btnAddMove);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AxisTipControl";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ComboBox comjSpeed;
private System.Windows.Forms.Button btnDelMove;
private System.Windows.Forms.Button btnAddMove;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox_pos;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btn_ok;
private System.Windows.Forms.Button btn_cancel;
}
using DeviceLibrary;
using HuichuanLibrary;
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;
public partial class AxisTipControl : Form
{
public AxisTipControl()
{
InitializeComponent();
this.Deactivate += AxisTipControl_Deactivate;
this.LostFocus += AxisTipControl_LostFocus;
this.TopMost = true;
}
private void AxisTipControl_LostFocus(object sender, EventArgs e)
{
//this.Close();
}
private void AxisTipControl_Deactivate(object sender, EventArgs e)
{
this.Close();
}
short SlvAddr;
string PortName;
int targetSpeed;
static Control c;
public void ShowTips(Control _c,string title, short axisid, int _targetSpeed)
{
if (_c.Tag == null)
return;
if (c!=null && c.Name == _c.Name)
return;
Text = title;
/*var cp = c.PointToScreen(new Point(0, 0));
var cc = this.Parent.PointToClient(cp);
cc.Y += c.Height;
this.Location = cc;
*/
c = _c;
SlvAddr = axisid;
PortName = c.Name;
targetSpeed = _targetSpeed;
comjSpeed.Items.Clear();
for (int i = 1; i <= 10; i++)
{
comjSpeed.Items.Add(targetSpeed * i / 10);
}
comjSpeed.SelectedIndex = 4;
//【2】读取轴状态,如果读取出错将关闭此定时器
AxisSts sts = HCBoardManager.GetAxisSts(SlvAddr);
if (sts.ServoOn < 0)
{
showToolTip("伺服尚未使能");
return;
}
if (sts.ALM != 0 || sts.WARN != 0 || sts.EMG != 0) {
showToolTip("伺服警报状态中");
return;
}
readPosition();
this.Show();
}
void showToolTip(string txt) {
var m_ToolTip = new ToolTip();
m_ToolTip.ToolTipIcon = ToolTipIcon.Warning;
m_ToolTip.ToolTipTitle = "无法操作";
m_ToolTip.AutoPopDelay = 0;
m_ToolTip.AutomaticDelay = 0;
m_ToolTip.InitialDelay = 0;
m_ToolTip.ShowAlways = true;
m_ToolTip.Show(txt, c);
Task.Run(() => {
Task.Delay(5000).Wait();
m_ToolTip.Dispose();
});
}
private void AxisMove(int speed)
{
LogUtil.info("【" + PortName + "_" + SlvAddr + "】点动: 速度:" + speed);
AxisManager.SpeedMove(PortName, SlvAddr, speed, speed * 3, speed * 3);
}
private void btnAddMove_MouseDown(object sender, MouseEventArgs e)
{
if (!CanMove())
{
return;
}
if (btnAddMove.BackColor.Equals(Color.White))
{
int speed = Convert.ToInt32(comjSpeed.Text);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
return;
}
btnAddMove.BackColor = Color.Green;
AxisMove(speed);
}
}
private void btnAddMove_MouseUp(object sender, MouseEventArgs e)
{
if (btnAddMove.BackColor == Color.Green)
{
btnAddMove.BackColor = Color.White;
AxisManager.SuddenStop(PortName, SlvAddr);
readPosition();
}
}
void readPosition()
{
textBox_pos.Text = AxisManager.GetActualtPosition(PortName, SlvAddr).ToString();
}
private void btnDelMove_MouseDown(object sender, MouseEventArgs e)
{
if (!CanMove())
{
return;
}
if (btnDelMove.BackColor.Equals(Color.White))
{
int speed = Convert.ToInt32(comjSpeed.Text);
if (speed <= 0)
{
MessageBox.Show("提示", "请先输入正确的速度");
return;
}
btnDelMove.BackColor = Color.Green;
AxisMove(-speed);
}
}
private void btnDelMove_MouseUp(object sender, MouseEventArgs e)
{
if (btnDelMove.BackColor == Color.Green)
{
btnDelMove.BackColor = Color.White;
AxisManager.SuddenStop(PortName, SlvAddr);
readPosition();
}
}
bool CanMove()
{
AxisSts sts = HCBoardManager.GetAxisSts(SlvAddr);
if (sts.ServoOn < 0)
{
showToolTip("伺服尚未使能");
return false;
}
if (sts.ALM != 0 || sts.WARN != 0 || sts.EMG != 0)
{
showToolTip("伺服警报状态中");
return false;
}
return true;
}
private void btn_cancel_Click(object sender, EventArgs e)
{
this.Close();
//c.Select();
//c.Focus();
}
private void btn_ok_Click(object sender, EventArgs e)
{
c.Text = textBox_pos.Text;
this.Close();
}
}
<?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
......@@ -142,7 +142,7 @@ namespace OnlineStore.LoadCSVLibrary
if (config == null || config.ConfigFilePath.Equals(""))
{
throw new Exception("没有配置配置文件路径");
return null;
//return null;
}
List<ConfigBase> configBasesList = ReadConfig(config.ConfigFilePath);
config.LoadConfig(configBasesList);
......
......@@ -78,7 +78,7 @@ namespace OnlineStore.LoadCSVLibrary
[CSVAttribute("目标速度")]
public int TargetSpeed { get; set; }
public new int TargetSpeed { get; set; }
[CSVAttribute("加速时间")]
......@@ -113,7 +113,7 @@ namespace OnlineStore.LoadCSVLibrary
}
public bool IsSameAxis(string portName, int slv)
{
if (DeviceName.Equals(portName) && slv.Equals(GetAxisValue()))
if (slv.Equals(GetAxisValue()))
{
return true;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!