Commit 021a213a 刘韬

稳定版本

1 个父辈 bedca39f
正在显示 34 个修改的文件 包含 623 行增加200 行删除
<?xml version="1.0"?> <?xml version="1.0"?>
<configuration> <configuration>
<configSections> <configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections> </configSections>
<appSettings> <appSettings>
<!--是否开机自动启动料仓--> <!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1" /> <add key="App_AutoRun" value="1"/>
<add key="App_Title" value="自动点料机" /> <add key="App_Title" value="自动点料机"/>
<add key="ServerAddr" value="http://10.85.17.233"/> <add key="ServerAddr" value="http://10.85.17.233"/>
<add key="ConfigPath_Robot" value="\RobotConfig\Config_Robot.csv" /> <add key="ConfigPath_Robot" value="\RobotConfig\Config_Robot.csv"/>
<add key="ConfigPath_XRay" value="\RobotConfig\Config_XRay.csv" /> <add key="ConfigPath_XRay" value="\RobotConfig\Config_XRay.csv"/>
<add key="ConfigPath_InputEquip" value="\RobotConfig\Config_InputEquip.csv" /> <add key="ConfigPath_InputEquip" value="\RobotConfig\Config_InputEquip.csv"/>
<add key="ConfigPath_OutputEquip" value="\RobotConfig\Config_OutputEquip.csv" /> <add key="ConfigPath_OutputEquip" value="\RobotConfig\Config_OutputEquip.csv"/>
<add key="CounParamConfig" value="\XRAY\countParam.csv" /> <add key="CounParamConfig" value="\XRAY\countParam.csv"/>
<!--二维码类型列表配置,用#分割,一维码=Barcode 二维码: QR Code#Data Matrix ECC 200#Micro QR Code--> <!--二维码类型列表配置,用#分割,一维码=Barcode 二维码: QR Code#Data Matrix ECC 200#Micro QR Code-->
<add key="CodeType" value="Data Matrix ECC 200#QR Code" /> <add key="CodeType" value="Data Matrix ECC 200#QR Code"/>
<!--<add key="CodeType" value="Data Matrix ECC 200"/>--> <!--<add key="CodeType" value="Data Matrix ECC 200"/>-->
<add key="ACBaudRate" value="115200" /> <add key="ACBaudRate" value="115200"/>
<!--二维码参数文件所在路径,文件名与二维码类型名一样--> <!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<add key="CodeParamPath" value="\CodeParam\\XRAY\countParam.csv" /> <add key="CodeParamPath" value="\CodeParam\\XRAY\countParam.csv"/>
<add key="Config_Pwd" value="123456" /> <add key="Config_Pwd" value="123456"/>
<add key="UseAIOBOX" value="1" /> <add key="UseAIOBOX" value="1"/>
<!--流水线监听端口--> <!--流水线监听端口-->
<add key="TCPServerPort" value="5246" /> <add key="TCPServerPort" value="5246"/>
<!--AGV调度服务器地址--> <!--AGV调度服务器地址-->
<add key="AgvServerIp" value="10.85.199.20" /> <add key="AgvServerIp" value="10.85.199.20"/>
<!--IO配置--> <!--IO配置-->
<add key="DIMS" value="60" /> <add key="DIMS" value="60"/>
<add key="DOMS" value="300" /> <add key="DOMS" value="300"/>
<add key="LineRunTest" value="1" /> <add key="LineRunTest" value="1"/>
<add key="DefaultPWD" value="123456" /> <add key="DefaultPWD" value="123456"/>
<add key="Server_Log_Open" value="0" /> <add key="Server_Log_Open" value="0"/>
<add key="CodeCount" value="3" /> <add key="CodeCount" value="3"/>
<add key="NeedScanCode" value="1" /> <add key="NeedScanCode" value="1"/>
<add key="Agv_Log_Open" value="0" /> <add key="Agv_Log_Open" value="0"/>
<!--检测到料串自动取料--> <!--检测到料串自动取料-->
<add key="AutoInput" value="1" /> <add key="AutoInput" value="1"/>
<add key ="InoutDefaultPosition" value ="1000"/> <add key="InoutDefaultPosition" value="1000"/>
<!--标签文件名称--> <!--标签文件名称-->
<add key ="LabelName" value ="test2"/> <add key="LabelName" value="test2"/>
<!--打印机名称ZDesigner GT800-300dpi EPL--> <!--打印机名称ZDesigner GT800-300dpi EPL-->
<add key ="PrinterName" value ="Microsoft Print to PDF"/> <add key="PrinterName" value="Microsoft Print to PDF"/>
<!--是否启用打印标签--> <!--是否启用打印标签-->
<add key ="NeedPrintLabel" value ="0"/> <add key="NeedPrintLabel" value="0"/>
<add key ="StickingPosJudgment" value ="0"/> <add key="StickingPosJudgment" value="0"/>
<!--XRay射线最后一次使用时间--> <!--XRay射线最后一次使用时间-->
<add key ="XRay_Data" value ="2020-6-2"/> <add key="XRay_Data" value="2020-6-2"/>
<add key ="ThresholdValue" value ="30"/> <add key="ThresholdValue" value="30"/>
<add key ="CounParamConfig" value ="\XRAY\countParam.csv"/> <add key="CounParamConfig" value="\XRAY\countParam.csv"/>
<add key ="DataPath" value ="\data\DB.db3"/> <add key="DataPath" value="\data\DB.db3"/>
<add key ="ResultMinCount" value ="100"/> <add key="ResultMinCount" value="100"/>
<add key ="ComPath_Config" value ="\XRAY\pnDetailedList.csv"/> <add key="ComPath_Config" value="\XRAY\pnDetailedList.csv"/>
<add key ="LabelWaitMS" value ="1000"/> <add key="LabelWaitMS" value="1000"/>
<add key ="UseLabel" value ="1"/> <add key="UseLabel" value="1"/>
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/autoCount.log" /> <file value="logs/autoCount.log"/>
<param name="Encoding" value="UTF-8" /> <param name="Encoding" value="UTF-8"/>
<appendToFile value="true" /> <appendToFile value="true"/>
<rollingStyle value="Date" /> <rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd" /> <datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout"> <layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" /> <conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout> </layout>
</appender> </appender>
<appender name="TheRFID" type="log4net.Appender.RollingFileAppender"> <appender name="TheRFID" type="log4net.Appender.RollingFileAppender">
<file value="logs/rfid/TheRFID.log" /> <file value="logs/rfid/TheRFID.log"/>
<param name="Encoding" value="UTF-8" /> <param name="Encoding" value="UTF-8"/>
<appendToFile value="true" /> <appendToFile value="true"/>
<rollingStyle value="Date" /> <rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd" /> <datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout"> <layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" /> <conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout> </layout>
</appender> </appender>
<appender name="XRay" type="log4net.Appender.RollingFileAppender"> <appender name="XRay" type="log4net.Appender.RollingFileAppender">
<file value="logs/xray/XRay.log" /> <file value="logs/xray/XRay.log"/>
<param name="Encoding" value="UTF-8" /> <param name="Encoding" value="UTF-8"/>
<appendToFile value="true" /> <appendToFile value="true"/>
<rollingStyle value="Date" /> <rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd" /> <datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout"> <layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" /> <conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout> </layout>
</appender> </appender>
<appender name="Count" type="log4net.Appender.RollingFileAppender"> <appender name="Count" type="log4net.Appender.RollingFileAppender">
<file value="logs/Count.log" /> <file value="logs/Count.log"/>
<param name="Encoding" value="UTF-8" /> <param name="Encoding" value="UTF-8"/>
<appendToFile value="true" /> <appendToFile value="true"/>
<rollingStyle value="Date" /> <rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd" /> <datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout"> <layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" /> <conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout> </layout>
</appender> </appender>
<appender name="AIOBOX" type="log4net.Appender.RollingFileAppender"> <appender name="AIOBOX" type="log4net.Appender.RollingFileAppender">
<file value="logs/aio/AIOBOX.log" /> <file value="logs/aio/AIOBOX.log"/>
<param name="Encoding" value="UTF-8" /> <param name="Encoding" value="UTF-8"/>
<appendToFile value="true" /> <appendToFile value="true"/>
<rollingStyle value="Date" /> <rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd" /> <datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout"> <layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" /> <conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout> </layout>
</appender> </appender>
<logger name="RollingLogFileAppender"> <logger name="RollingLogFileAppender">
<level value="Info" /> <level value="Info"/>
<appender-ref ref="RollingLogFileAppender" /> <appender-ref ref="RollingLogFileAppender"/>
</logger> </logger>
<logger name="TheRFID"> <logger name="TheRFID">
<level value="Info" /> <level value="Info"/>
<appender-ref ref="TheRFID" /> <appender-ref ref="TheRFID"/>
</logger> </logger>
<logger name="XRay"> <logger name="XRay">
<level value="Info" /> <level value="Info"/>
<appender-ref ref="XRay" /> <appender-ref ref="XRay"/>
</logger> </logger>
<logger name="Count"> <logger name="Count">
<level value="Info" /> <level value="Info"/>
<appender-ref ref="Count" /> <appender-ref ref="Count"/>
</logger> </logger>
<logger name="AIOBOX"> <logger name="AIOBOX">
<level value="Info" /> <level value="Info"/>
<appender-ref ref="AIOBOX" /> <appender-ref ref="AIOBOX"/>
</logger> </logger>
<!--<root> <!--<root>
...@@ -138,6 +138,6 @@ ...@@ -138,6 +138,6 @@
</root>--> </root>-->
</log4net> </log4net>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
</startup> </startup>
</configuration>
\ No newline at end of file \ No newline at end of file
</configuration>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.AutoCountClient</RootNamespace> <RootNamespace>OnlineStore.AutoCountClient</RootNamespace>
<AssemblyName>AutoCountClient</AssemblyName> <AssemblyName>AutoCountClient</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl> <PublishUrl>publish\</PublishUrl>
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
</Reference> </Reference>
<Reference Include="Asa.CarerayImage, Version=1.1.2.1, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Asa.CarerayImage, Version=1.1.2.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\CarerayImage\CarerayImage\bin\Debug\Asa.CarerayImage.dll</HintPath> <HintPath>..\..\oldDll\Asa.CarerayImage.dll</HintPath>
</Reference> </Reference>
<Reference Include="Asa.PrintLabel"> <Reference Include="Asa.PrintLabel">
<HintPath>..\..\dll\label\Asa.PrintLabel.dll</HintPath> <HintPath>..\..\dll\label\Asa.PrintLabel.dll</HintPath>
......
...@@ -364,7 +364,8 @@ namespace OnlineStore.AutoCountClient ...@@ -364,7 +364,8 @@ namespace OnlineStore.AutoCountClient
{ {
if (equipBean.runStatus.Equals(RobotRunStatus.Runing)) if (equipBean.runStatus.Equals(RobotRunStatus.Runing))
{ {
if (equipBean.IOValue(IO_Type.Out_TrayCheck).Equals(IO_VALUE.HIGH) && equipBean.IOValue(IO_Type.X_OLine_Run).Equals(IO_VALUE.LOW)) var re = equipBean.Out_TrayCheck_Test(RobotManager.robot.outputEquip.Config.CameraName, IO_VALUE.HIGH);
if (re.GetValueOrDefault() && equipBean.IOValue(IO_Type.X_OLine_Run).Equals(IO_VALUE.LOW))
{ {
WorkParam param = new WorkParam(); WorkParam param = new WorkParam();
param.IsTest = true; param.IsTest = true;
...@@ -379,9 +380,9 @@ namespace OnlineStore.AutoCountClient ...@@ -379,9 +380,9 @@ namespace OnlineStore.AutoCountClient
LogUtil.info(equipBean.Name + "点击:取放料测试"); LogUtil.info(equipBean.Name + "点击:取放料测试");
equipBean.StartWorking(param); equipBean.StartWorking(param);
} }
else else if (re.HasValue)
{ {
if (equipBean.IOValue(IO_Type.Out_TrayCheck).Equals(IO_VALUE.LOW)) if (!re.Value)
{ {
MessageBox.Show("XRay出口未检测到料盘,取放料测试 失败"); MessageBox.Show("XRay出口未检测到料盘,取放料测试 失败");
} }
......
...@@ -384,7 +384,7 @@ ...@@ -384,7 +384,7 @@
this.批量ToolStripMenuItem, this.批量ToolStripMenuItem,
this.单盘ToolStripMenuItem}); this.单盘ToolStripMenuItem});
this.元器件学习ToolStripMenuItem.Name = "元器件学习ToolStripMenuItem"; this.元器件学习ToolStripMenuItem.Name = "元器件学习ToolStripMenuItem";
this.元器件学习ToolStripMenuItem.Size = new System.Drawing.Size(160, 26); this.元器件学习ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.元器件学习ToolStripMenuItem.Text = "元器件学习"; this.元器件学习ToolStripMenuItem.Text = "元器件学习";
this.元器件学习ToolStripMenuItem.Click += new System.EventHandler(this.元器件学习ToolStripMenuItem_Click); this.元器件学习ToolStripMenuItem.Click += new System.EventHandler(this.元器件学习ToolStripMenuItem_Click);
// //
...@@ -405,24 +405,24 @@ ...@@ -405,24 +405,24 @@
// toolStripSeparator17 // toolStripSeparator17
// //
this.toolStripSeparator17.Name = "toolStripSeparator17"; this.toolStripSeparator17.Name = "toolStripSeparator17";
this.toolStripSeparator17.Size = new System.Drawing.Size(157, 6); this.toolStripSeparator17.Size = new System.Drawing.Size(177, 6);
// //
// 二维码学习ToolStripMenuItem // 二维码学习ToolStripMenuItem
// //
this.二维码学习ToolStripMenuItem.Name = "二维码学习ToolStripMenuItem"; this.二维码学习ToolStripMenuItem.Name = "二维码学习ToolStripMenuItem";
this.二维码学习ToolStripMenuItem.Size = new System.Drawing.Size(160, 26); this.二维码学习ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.二维码学习ToolStripMenuItem.Text = "二维码学习"; this.二维码学习ToolStripMenuItem.Text = "二维码学习";
this.二维码学习ToolStripMenuItem.Click += new System.EventHandler(this.二维码学习ToolStripMenuItem_Click); this.二维码学习ToolStripMenuItem.Click += new System.EventHandler(this.二维码学习ToolStripMenuItem_Click);
// //
// toolStripSeparator7 // toolStripSeparator7
// //
this.toolStripSeparator7.Name = "toolStripSeparator7"; this.toolStripSeparator7.Name = "toolStripSeparator7";
this.toolStripSeparator7.Size = new System.Drawing.Size(157, 6); this.toolStripSeparator7.Size = new System.Drawing.Size(177, 6);
// //
// toolStripMenuItem2 // toolStripMenuItem2
// //
this.toolStripMenuItem2.Name = "toolStripMenuItem2"; this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(160, 26); this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 26);
this.toolStripMenuItem2.Text = "AGV调试"; this.toolStripMenuItem2.Text = "AGV调试";
this.toolStripMenuItem2.Visible = false; this.toolStripMenuItem2.Visible = false;
this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click); this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click);
...@@ -430,13 +430,13 @@ ...@@ -430,13 +430,13 @@
// toolStripSeparator6 // toolStripSeparator6
// //
this.toolStripSeparator6.Name = "toolStripSeparator6"; this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(157, 6); this.toolStripSeparator6.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator6.Visible = false; this.toolStripSeparator6.Visible = false;
// //
// 标签编辑ToolStripMenuItem // 标签编辑ToolStripMenuItem
// //
this.标签编辑ToolStripMenuItem.Name = "标签编辑ToolStripMenuItem"; this.标签编辑ToolStripMenuItem.Name = "标签编辑ToolStripMenuItem";
this.标签编辑ToolStripMenuItem.Size = new System.Drawing.Size(160, 26); this.标签编辑ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.标签编辑ToolStripMenuItem.Text = "标签编辑"; this.标签编辑ToolStripMenuItem.Text = "标签编辑";
this.标签编辑ToolStripMenuItem.Click += new System.EventHandler(this.标签编辑ToolStripMenuItem_Click); this.标签编辑ToolStripMenuItem.Click += new System.EventHandler(this.标签编辑ToolStripMenuItem_Click);
// //
...@@ -600,6 +600,7 @@ ...@@ -600,6 +600,7 @@
this.启用光栅信号ToolStripMenuItem.Name = "启用光栅信号ToolStripMenuItem"; this.启用光栅信号ToolStripMenuItem.Name = "启用光栅信号ToolStripMenuItem";
this.启用光栅信号ToolStripMenuItem.Size = new System.Drawing.Size(213, 26); this.启用光栅信号ToolStripMenuItem.Size = new System.Drawing.Size(213, 26);
this.启用光栅信号ToolStripMenuItem.Text = "启用光栅信号"; this.启用光栅信号ToolStripMenuItem.Text = "启用光栅信号";
this.启用光栅信号ToolStripMenuItem.Visible = false;
this.启用光栅信号ToolStripMenuItem.Click += new System.EventHandler(this.启用光栅信号ToolStripMenuItem_Click); this.启用光栅信号ToolStripMenuItem.Click += new System.EventHandler(this.启用光栅信号ToolStripMenuItem_Click);
// //
// toolStripSeparator14 // toolStripSeparator14
......
...@@ -10,6 +10,11 @@ using System.Runtime.InteropServices; ...@@ -10,6 +10,11 @@ using System.Runtime.InteropServices;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using OnlineStore.DeviceLibrary; using OnlineStore.DeviceLibrary;
using System.Drawing;
using CodeLibrary;
using System.IO;
using System.Text;
using System.Xml.Serialization;
namespace OnlineStore.AutoCountClient namespace OnlineStore.AutoCountClient
{ {
...@@ -54,8 +59,15 @@ namespace OnlineStore.AutoCountClient ...@@ -54,8 +59,15 @@ namespace OnlineStore.AutoCountClient
[STAThread] [STAThread]
static void Main(string[] Args) static void Main(string[] Args)
{ {
//string code = " (X: 380,Y: 148) L00000000000WG9D19055;E20191230 0180;B7H.10618.5B1008082019123004000;R0080820191230E9600"; //string code = " (X: 380,Y: 148) L00000000000WG9D19055;E20191230 0180;B7H.10618.5B1008082019123004000;R0080820191230E9600";
//string r = CodeManager.ReplaceCode(code); //string r = CodeManager.ReplaceCode(code);
//var b = new Bitmap(@"D:\logs\20230309\xray_监控点1_out_20230309091352_1646057.bmp");
//EyemManager.ReelCheck(b);
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
......
...@@ -19,7 +19,7 @@ namespace OnlineStore.AutoCountClient.Properties { ...@@ -19,7 +19,7 @@ namespace OnlineStore.AutoCountClient.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。 // (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources { internal class Resources {
...@@ -47,8 +47,8 @@ namespace OnlineStore.AutoCountClient.Properties { ...@@ -47,8 +47,8 @@ namespace OnlineStore.AutoCountClient.Properties {
} }
/// <summary> /// <summary>
/// 重写当前线程的 CurrentUICulture 属性 /// 重写当前线程的 CurrentUICulture 属性,对
/// 重写当前线程的 CurrentUICulture 属性 /// 使用此强类型资源类的所有资源查找执行重写
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture { internal static global::System.Globalization.CultureInfo Culture {
...@@ -58,6 +58,16 @@ namespace OnlineStore.AutoCountClient.Properties { ...@@ -58,6 +58,16 @@ namespace OnlineStore.AutoCountClient.Properties {
set { set {
resourceCulture = value; resourceCulture = value;
} }
} }
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap _152827 {
get {
object obj = ResourceManager.GetObject("152827", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
} }
} }
...@@ -12,7 +12,7 @@ namespace OnlineStore.AutoCountClient.Properties { ...@@ -12,7 +12,7 @@ namespace OnlineStore.AutoCountClient.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
<?xml version="1.0"?> <?xml version="1.0"?>
<configuration> <configuration>
<configSections> <configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections> </configSections>
<appSettings> <appSettings>
...@@ -33,12 +33,12 @@ ...@@ -33,12 +33,12 @@
<add key="OutStoreWaitSeconds" value="10"/> <add key="OutStoreWaitSeconds" value="10"/>
<add key="UseAIOBOX" value="1"/> <add key="UseAIOBOX" value="1"/>
<!--流水线监听端口--> <!--流水线监听端口-->
<add key ="TCPServerPort" value ="5246"/> <add key="TCPServerPort" value="5246"/>
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/Line-RC1246.log"/> <file value="logs/Line-RC1246.log"/>
<param name="Encoding" value="UTF-8" /> <param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/> <appendToFile value="true"/>
<rollingStyle value="Date"/> <rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/> <datePattern value="yyyy-MM-dd"/>
...@@ -52,6 +52,6 @@ ...@@ -52,6 +52,6 @@
</root> </root>
</log4net> </log4net>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup> </startup>
</configuration>
\ No newline at end of file \ No newline at end of file
</configuration>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AssemblyLineSystem</RootNamespace> <RootNamespace>AssemblyLineSystem</RootNamespace>
<AssemblyName>AssemblyLineSystem</AssemblyName> <AssemblyName>AssemblyLineSystem</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CodeLibrary</RootNamespace> <RootNamespace>CodeLibrary</RootNamespace>
<AssemblyName>CodeLibrary</AssemblyName> <AssemblyName>CodeLibrary</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
...@@ -95,6 +95,7 @@ ...@@ -95,6 +95,7 @@
<Compile Include="ImageHelper.cs" /> <Compile Include="ImageHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="CodeResourceControl.cs" /> <Compile Include="CodeResourceControl.cs" />
<Compile Include="RemoteDecodeHelper.cs" />
<Compile Include="ZXingCodeHelper.cs" /> <Compile Include="ZXingCodeHelper.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
......
...@@ -577,6 +577,7 @@ public class CodeInfo ...@@ -577,6 +577,7 @@ public class CodeInfo
public int Y = 0; public int Y = 0;
public string CodeType; public string CodeType;
public double Orientation = 0; public double Orientation = 0;
public CodeInfo() { }
public CodeInfo(string codeStr,int x,int y) public CodeInfo(string codeStr,int x,int y)
{ {
this.CodeStr = codeStr; this.CodeStr = codeStr;
......
using CodeLibrary;
using HalconDotNet;
using Microsoft.Win32;
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
{
static int webclienttimeout = 30 * 1000;
static Process p = new Process();
static string serverhost = "http://127.0.0.1:58137/";
public static List<CodeInfo> DecodeRequest(HObject hoimg, RemoteDecodeParam remoteDecodeParam)
{
byte[] requestdata;
lock (hoimg)
{
using (MemoryStream mStream = new MemoryStream())
{
hoimg.Serialize(mStream);
requestdata = mStream.ToArray();
mStream.Close();
}
}
return DecodeRequest(requestdata, remoteDecodeParam,true);
}
public static List<CodeInfo> DecodeRequest(Bitmap bitmap, RemoteDecodeParam remoteDecodeParam)
{
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 List<CodeInfo> DecodeRequest(byte[] requestdata, RemoteDecodeParam remoteDecodeParam,bool isHObject=false)
{
try
{
CheckAndRunServer();
}
catch {
return new List<CodeInfo> { new CodeInfo("ScanCodeServer error",0,0) };
}
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+"ProcessBitmap?param=";
if (isHObject)
url = serverhost+"Process?param=";
byte[] resp;
try
{
using (MyWebClient webClient = new MyWebClient(webclienttimeout))
{
resp = webClient.UploadData(url + param, requestdata);
requestdata = null;
}
}
catch(WebException we)
{
return null;
}
catch
{
return null;
}
List<CodeInfo> codeInfos=null;
var ss = Encoding.UTF8.GetString(resp).Trim().Trim('"');
ss = ss.Replace(@"\/", "/");
try
{
var bb = Convert.FromBase64String(ss);
using (MemoryStream mStreamResult = new MemoryStream(bb))
{
XmlSerializer xff = new XmlSerializer(typeof(List<CodeInfo>));
codeInfos = (List<CodeInfo>)xff.Deserialize(mStreamResult);
}
}
catch {
throw new Exception(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("ScanCodeServer");
if (pss.Length > 0)
return;
var f = "ScanCodeServer\\ScanCodeServer.exe";
if (!File.Exists(f))
throw new Exception("找不到扫码服务器文件");
p.StartInfo = new ProcessStartInfo(f);
p.Start();
int checkcount = 5;
while (checkcount > 0)
{
checkcount--;
Thread.Sleep(500);
var port = (int)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\ScanCodeServer\\", "port", 58137);
serverhost = "http://127.0.0.1:"+ port + "/";
using (MyWebClient webClient = new MyWebClient(webclienttimeout))
{
var s = webClient.DownloadString(serverhost + "alive");
if (s.Trim() == "\"1\"")
return;
}
}
throw new Exception("扫码服务器打开失败,退出码:"+ p.ExitCode);
}
}
[Serializable]
public struct RemoteDecodeParam
{
public string[] codeTypeList;
public int codeCount;
public int timeout;
}
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;
}
}
}
...@@ -9,7 +9,6 @@ using System.Runtime.InteropServices; ...@@ -9,7 +9,6 @@ using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using static Asa.eyemLib;
namespace CodeLibrary namespace CodeLibrary
{ {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.Common</RootNamespace> <RootNamespace>OnlineStore.Common</RootNamespace>
<AssemblyName>MyCommon</AssemblyName> <AssemblyName>MyCommon</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.DeviceLibrary</RootNamespace> <RootNamespace>OnlineStore.DeviceLibrary</RootNamespace>
<AssemblyName>DeviceLibrary</AssemblyName> <AssemblyName>DeviceLibrary</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
<LangVersion>7.3</LangVersion> <LangVersion>7.3</LangVersion>
...@@ -41,9 +41,13 @@ ...@@ -41,9 +41,13 @@
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Asa.CarerayImage, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Asa.Camera.VisionLib, Version=1.3.8398.28384, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\oldDll\Asa.Camera.VisionLib.dll</HintPath>
</Reference>
<Reference Include="Asa.CarerayImage, Version=1.1.2.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\CarerayImage\CarerayImage\bin\Debug\Asa.CarerayImage.dll</HintPath> <HintPath>..\..\oldDll\Asa.CarerayImage.dll</HintPath>
</Reference> </Reference>
<Reference Include="Asa.IOModule.AIOBOX"> <Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath> <HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
...@@ -99,6 +103,8 @@ ...@@ -99,6 +103,8 @@
<Compile Include="bean\BatchMoveBean_Partial.cs" /> <Compile Include="bean\BatchMoveBean_Partial.cs" />
<Compile Include="bean\BatchMoveBean.cs" /> <Compile Include="bean\BatchMoveBean.cs" />
<Compile Include="bean\OutputEquip_Shelf.cs" /> <Compile Include="bean\OutputEquip_Shelf.cs" />
<Compile Include="deviceLibrary\Camera.cs" />
<Compile Include="deviceLibrary\EyemManager.cs" />
<Compile Include="deviceLibrary\TestPlate.cs" /> <Compile Include="deviceLibrary\TestPlate.cs" />
<Compile Include="FrmDevicePause.cs"> <Compile Include="FrmDevicePause.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
......
...@@ -22,6 +22,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -22,6 +22,7 @@ namespace OnlineStore.DeviceLibrary
/// 手动报警 /// 手动报警
/// </summary> /// </summary>
public bool NeedAlarm = false; public bool NeedAlarm = false;
protected DeviceConfig Config;
protected void SetAllTimer(bool open) protected void SetAllTimer(bool open)
{ {
...@@ -405,7 +406,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -405,7 +406,11 @@ namespace OnlineStore.DeviceLibrary
{ {
wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds); wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
} }
else if (wait.WaitType.Equals(WaitEnum.W013_Action))
{
wait.IsEnd = wait.Action.Invoke(wait);
LogUtil.info($"{Name} 自定义等待 IsEnd={wait.IsEnd},Type={wait.Action.GetType()}");
}
else else
{ {
wait.IsEnd = CheckWaitResult(moveInfo, wait); wait.IsEnd = CheckWaitResult(moveInfo, wait);
...@@ -797,5 +802,23 @@ namespace OnlineStore.DeviceLibrary ...@@ -797,5 +802,23 @@ namespace OnlineStore.DeviceLibrary
SetWarnMsg(""); SetWarnMsg("");
} }
} }
public bool? Out_TrayCheck_Test(string CameraName,IO_VALUE iO_VALUE) {
if (!RobotManager.Camera_Out_TrayCheck_Test)
return IOValue(IO_Type.Out_TrayCheck).Equals(iO_VALUE);
//if (iO_VALUE == IO_VALUE.HIGH)
// if (IOValue(IO_Type.Out_TrayCheck).Equals(IO_VALUE.HIGH))
// return true;
var result = EyemManager.CameraTestReel(CameraName);
if (!result.HasValue)
return null;
if (iO_VALUE == IO_VALUE.HIGH)
return result.Value;
else
return !result.Value;
}
} }
} }
...@@ -530,15 +530,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -530,15 +530,10 @@ namespace OnlineStore.DeviceLibrary
{ {
return; return;
} }
if (LeftBatchMove.ProcessShelfOut || LeftBatchMove.ProcessShelfEnter || RightBatchMove.ProcessShelfOut || RightBatchMove.ProcessShelfEnter) if (LeftBatchMove.ProcessShelfOut || LeftBatchMove.ProcessShelfEnter || RightBatchMove.ProcessShelfOut || RightBatchMove.ProcessShelfEnter)
{ {
return; Debug.WriteLine($"GS:{LeftBatchMove.ProcessShelfOut},{LeftBatchMove.ProcessShelfEnter},{RightBatchMove.ProcessShelfOut},{RightBatchMove.ProcessShelfOut}");
}
if (CanStartWork()) {
return;
}
if (LeftBatchMove.MoveInfo.MoveStep == StepEnum.Wait)
{
return; return;
} }
if (IOValue(IO_Type.LineIn_GratingSignal).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.LineIn_GratingSignal).Equals(IO_VALUE.LOW))
...@@ -558,7 +553,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -558,7 +553,15 @@ namespace OnlineStore.DeviceLibrary
} }
NeedAlarm = false; NeedAlarm = false;
} }
} }
if (CanStartWork()) {
return;
}
if (LeftBatchMove.MoveInfo.MoveStep == StepEnum.Wait)
{
return;
}
} }
#endregion #endregion
......
...@@ -5,6 +5,7 @@ using System.Collections.Concurrent; ...@@ -5,6 +5,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Security.AccessControl;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -13,7 +14,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -13,7 +14,7 @@ namespace OnlineStore.DeviceLibrary
{ {
public partial class OutputEquip : EquipBase public partial class OutputEquip : EquipBase
{ {
public OutputEquip_Config Config; public new OutputEquip_Config Config;
public AxisBean MoveZAxis = null; public AxisBean MoveZAxis = null;
...@@ -593,6 +594,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -593,6 +594,7 @@ namespace OnlineStore.DeviceLibrary
private Stopwatch needEnterWatch = new Stopwatch(); private Stopwatch needEnterWatch = new Stopwatch();
private Stopwatch needLeaveWatch = new Stopwatch(); private Stopwatch needLeaveWatch = new Stopwatch();
private Asa.ClientLevel curAgvOutLevel = Asa.ClientLevel.Low; private Asa.ClientLevel curAgvOutLevel = Asa.ClientLevel.Low;
DateTime lastCheckOutReelTime = DateTime.Now;
protected override void BaseTimerProcess() protected override void BaseTimerProcess()
{ {
if (isInSuddenDown || isNoAirCheck) if (isInSuddenDown || isNoAirCheck)
...@@ -618,9 +620,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -618,9 +620,10 @@ namespace OnlineStore.DeviceLibrary
} }
} }
if (MoveInfo.MoveType.Equals(RobotMoveType.None)) if (MoveInfo.MoveType.Equals(RobotMoveType.None) && (DateTime.Now - lastCheckOutReelTime).TotalSeconds > 2)
{ {
if (NoErrorAlarm() && IOValue(IO_Type.Out_TrayCheck).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.X_OLine_Run).Equals(IO_VALUE.LOW)) lastCheckOutReelTime = DateTime.Now;
if (NoErrorAlarm() && IOValue(IO_Type.X_OLine_Run).Equals(IO_VALUE.LOW) && Out_TrayCheck_Test(Config.CameraName,IO_VALUE.HIGH).GetValueOrDefault())
{ {
//料串准备好才能取料 //料串准备好才能取料
if (OutReelCount >= 0) if (OutReelCount >= 0)
......
...@@ -85,7 +85,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -85,7 +85,7 @@ namespace OnlineStore.DeviceLibrary
return false; return false;
} }
if (IOValue(IO_Type.Out_TrayCheck).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.X_OLine_Run).Equals(IO_VALUE.LOW)) if (Out_TrayCheck_Test(Config.CameraName, IO_VALUE.HIGH).GetValueOrDefault() && IOValue(IO_Type.X_OLine_Run).Equals(IO_VALUE.LOW))
{ {
IsStartLabel = false; IsStartLabel = false;
MoveInfo.NewMove(RobotMoveType.Working, StepEnum.OT01_WaitCheck); MoveInfo.NewMove(RobotMoveType.Working, StepEnum.OT01_WaitCheck);
...@@ -113,7 +113,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -113,7 +113,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.MoveParam.IsNgReel = true; MoveInfo.MoveParam.IsNgReel = true;
} }
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.HIGH)); //MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.X_OLine_Run, IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.X_OLine_Run, IO_VALUE.LOW));
} }
return false; return false;
...@@ -387,7 +387,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -387,7 +387,7 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsStep(StepEnum.OT08_2_Wait_Out_TrayCheck)) else if (MoveInfo.IsStep(StepEnum.OT08_2_Wait_Out_TrayCheck))
{ {
if (IOValue(IO_Type.Out_TrayCheck).Equals(IO_VALUE.LOW)) if (Out_TrayCheck_Test(Config.CameraName, IO_VALUE.LOW).GetValueOrDefault())
{ {
TakeReelRetay = 0; TakeReelRetay = 0;
ClearTimeoutAlarm("取料失败"); ClearTimeoutAlarm("取料失败");
...@@ -424,13 +424,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -424,13 +424,17 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsStep(StepEnum.OT08_3_Wait_Out_TrayCheck)) else if (MoveInfo.IsStep(StepEnum.OT08_3_Wait_Out_TrayCheck))
{ {
if (IOValue(IO_Type.Out_TrayCheck).Equals(IO_VALUE.LOW)) var re = Out_TrayCheck_Test(Config.CameraName, IO_VALUE.LOW);
if (re.GetValueOrDefault())
{ {
ClearTimeoutAlarm("取料失败"); ClearTimeoutAlarm("取料失败");
MoveInfo.NextMoveStep(StepEnum.OT25_NG_NGBack); MoveInfo.NextMoveStep(StepEnum.OT25_NG_NGBack);
NeedAlarm = false; NeedAlarm = false;
} }
else { else if (re.HasValue) {
EyemManager.record = true;
Out_TrayCheck_Test(Config.CameraName, IO_VALUE.LOW);
EyemManager.record = false;
WarnMsg = MoveInfo.Name + "[取料:取料失败,已重试3次,请手动取走料盘]"; WarnMsg = MoveInfo.Name + "[取料:取料失败,已重试3次,请手动取走料盘]";
//WorkLog(WarnMsg); //WorkLog(WarnMsg);
Alarm(AlarmType.IoSingleTimeOut); Alarm(AlarmType.IoSingleTimeOut);
......
...@@ -27,7 +27,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -27,7 +27,7 @@ namespace OnlineStore.DeviceLibrary
public X_RAY_Equip XrayBean; public X_RAY_Equip XrayBean;
public OutputEquip outputEquip; public OutputEquip outputEquip;
public Dictionary<int, EquipBase> equipsMap = new Dictionary<int, EquipBase>(); public Dictionary<int, EquipBase> equipsMap = new Dictionary<int, EquipBase>();
public Robot_Config Config = null; public Robot_Config Config = null;
private bool canStart = false; private bool canStart = false;
public SQLite sQLite = null; public SQLite sQLite = null;
...@@ -59,6 +59,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -59,6 +59,7 @@ namespace OnlineStore.DeviceLibrary
inputEquip = new InputEquip("1", fconfig); inputEquip = new InputEquip("1", fconfig);
XrayBean = new X_RAY_Equip("2", xconfig); XrayBean = new X_RAY_Equip("2", xconfig);
outputEquip = new OutputEquip("3", pconfig); outputEquip = new OutputEquip("3", pconfig);
equipsMap.Add(1, inputEquip); equipsMap.Add(1, inputEquip);
equipsMap.Add(2, XrayBean); equipsMap.Add(2, XrayBean);
equipsMap.Add(3, outputEquip); equipsMap.Add(3, outputEquip);
...@@ -70,6 +71,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -70,6 +71,12 @@ namespace OnlineStore.DeviceLibrary
AgvClient.NodeList.Add(inputEquip.Config.RightAgvName); AgvClient.NodeList.Add(inputEquip.Config.RightAgvName);
AgvClient.NodeList.Add(inputEquip.Config.LeftAgvName); AgvClient.NodeList.Add(inputEquip.Config.LeftAgvName);
EyemManager.record = true;
outputEquip.Out_TrayCheck_Test(outputEquip.Config.CameraName, IO_VALUE.HIGH);
EyemManager.record = false;
/*var carerayImage = new CarerayImage(); /*var carerayImage = new CarerayImage();
if (carerayImage.Open()) if (carerayImage.Open())
{ {
......
...@@ -23,7 +23,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -23,7 +23,7 @@ namespace OnlineStore.DeviceLibrary
public ReelInfo Work_ReelInfo = new ReelInfo(); public ReelInfo Work_ReelInfo = new ReelInfo();
public ReelInfo Out_ReelInfo = new ReelInfo(); public ReelInfo Out_ReelInfo = new ReelInfo();
public XRay_Config Config; public new XRay_Config Config;
public XRay xRay = null; public XRay xRay = null;
...@@ -192,13 +192,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -192,13 +192,10 @@ namespace OnlineStore.DeviceLibrary
{ {
try try
{ {
if (xRay!=null && xRay.IsRayOpen) if (xRay!=null && xRay.IsRayOpen)
{ xRay.Stop();
xRay.Stop(); xRay?.Close();
} xrayImage?.Close();
if (xRay != null)
xRay.Close();
xrayImage.Close();
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -279,7 +276,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -279,7 +276,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StepEnum.XR02_DoorOpen); MoveInfo.NextMoveStep(StepEnum.XR02_DoorOpen);
CylinderMove(MoveInfo, IO_Type.X_InDoor_Up, IO_Type.X_InDoor_Down); CylinderMove(MoveInfo, IO_Type.X_InDoor_Up, IO_Type.X_InDoor_Down);
CylinderMove(MoveInfo, IO_Type.X_OutDoor_Up, IO_Type.X_OutDoor_Down); CylinderMove(MoveInfo, IO_Type.X_OutDoor_Up, IO_Type.X_OutDoor_Down);
if (IOValue(IO_Type.X_ReelCheck).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.Out_TrayCheck).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.X_ReelCheck).Equals(IO_VALUE.HIGH) && Out_TrayCheck_Test(RobotManager.robot.outputEquip.Config.CameraName, IO_VALUE.HIGH).GetValueOrDefault())
{ {
WorkLog("XRay复位 :左侧们打开,右侧门打开,挡停下降"); WorkLog("XRay复位 :左侧们打开,右侧门打开,挡停下降");
CylinderMove(MoveInfo, IO_Type.X_StopCylinder_Up, IO_Type.X_StopCylinder_Down); CylinderMove(MoveInfo, IO_Type.X_StopCylinder_Up, IO_Type.X_StopCylinder_Down);
......
...@@ -64,7 +64,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -64,7 +64,7 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.NextMoveStep(StepEnum.XW21_WaitOutNoReel); MoveInfo.NextMoveStep(StepEnum.XW21_WaitOutNoReel);
WorkLog("扫描区有料[" + Work_ReelInfo.ToStr() + "],点料已完成,准备放出料盘"); WorkLog("扫描区有料[" + Work_ReelInfo.ToStr() + "],点料已完成,准备放出料盘");
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>((w)=> { return Out_TrayCheck_Test(RobotManager.robot.outputEquip.Config.CameraName,IO_VALUE.LOW).GetValueOrDefault(); }), $"等待[Out_TrayCheck=Low]"));
} }
} }
else if (IOValue(IO_Type.X_InLine_Check).Equals(IO_VALUE.HIGH)) else if (IOValue(IO_Type.X_InLine_Check).Equals(IO_VALUE.HIGH))
...@@ -175,7 +175,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -175,7 +175,7 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.NextMoveStep(StepEnum.XW21_WaitOutNoReel); MoveInfo.NextMoveStep(StepEnum.XW21_WaitOutNoReel);
WorkLog("扫描区NG料 [" + Work_ReelInfo.ToStr() + "],直接放行料盘"); WorkLog("扫描区NG料 [" + Work_ReelInfo.ToStr() + "],直接放行料盘");
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>((w) => { return Out_TrayCheck_Test(RobotManager.robot.outputEquip.Config.CameraName, IO_VALUE.LOW).GetValueOrDefault(); }), $"等待[Out_TrayCheck=Low]"));
} }
else else
{ {
...@@ -281,13 +281,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -281,13 +281,14 @@ namespace OnlineStore.DeviceLibrary
#endregion #endregion
else if (MoveInfo.IsStep(StepEnum.XW16_EndCount)) else if (MoveInfo.IsStep(StepEnum.XW16_EndCount))
{ {
if (IOValue(IO_Type.Out_TrayCheck).Equals(IO_VALUE.LOW)) var re = Out_TrayCheck_Test(RobotManager.robot.outputEquip.Config.CameraName, IO_VALUE.LOW);
if (re.GetValueOrDefault())
{ {
MoveInfo.NextMoveStep(StepEnum.XW21_WaitOutNoReel); MoveInfo.NextMoveStep(StepEnum.XW21_WaitOutNoReel);
//MoveInfo.TimeOutSeconds = 120; //MoveInfo.TimeOutSeconds = 120;
WorkLog("料盘处理:出口无料盘继续", 0); WorkLog("料盘处理:出口无料盘继续", 0);
} }
else if (RobotManager.robot.outputEquip.HasWorkingShelf) else if (re.HasValue && RobotManager.robot.outputEquip.HasWorkingShelf)
{ {
if (MoveInfo.IsTimeOut(120)) { if (MoveInfo.IsTimeOut(120)) {
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "]" + "等待 出口皮带线料盘离开X57=Low 超时[" + FormUtil.GetSpanStr(MoveInfo.StepSpan()) + "]"; WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "]" + "等待 出口皮带线料盘离开X57=Low 超时[" + FormUtil.GetSpanStr(MoveInfo.StepSpan()) + "]";
...@@ -295,7 +296,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -295,7 +296,7 @@ namespace OnlineStore.DeviceLibrary
Alarm(AlarmType.IoSingleTimeOut); Alarm(AlarmType.IoSingleTimeOut);
} }
} }
else { else if (re.HasValue){
LogUtil.error("当前出口没有料串", MoveInfo.ErrorLogType); LogUtil.error("当前出口没有料串", MoveInfo.ErrorLogType);
MoveInfo.NextMoveStep(StepEnum.XW16_EndCount); MoveInfo.NextMoveStep(StepEnum.XW16_EndCount);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
...@@ -315,7 +316,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -315,7 +316,7 @@ namespace OnlineStore.DeviceLibrary
WorkLog("料盘处理:右侧门打开,挡停放行", 0); WorkLog("料盘处理:右侧门打开,挡停放行", 0);
CylinderMove(MoveInfo, IO_Type.X_OutDoor_Up, IO_Type.X_OutDoor_Down); CylinderMove(MoveInfo, IO_Type.X_OutDoor_Up, IO_Type.X_OutDoor_Down);
CylinderMove(MoveInfo, IO_Type.X_StopCylinder_Down, IO_Type.X_StopCylinder_Up); CylinderMove(MoveInfo, IO_Type.X_StopCylinder_Down, IO_Type.X_StopCylinder_Up);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>((w) => { return Out_TrayCheck_Test(RobotManager.robot.outputEquip.Config.CameraName, IO_VALUE.LOW).GetValueOrDefault(); }), $"等待[Out_TrayCheck=Low]"));
} }
else if (MoveInfo.IsTimeOut(120)) else if (MoveInfo.IsTimeOut(120))
{ {
...@@ -326,14 +327,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -326,14 +327,15 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsStep(StepEnum.XW22_OutDoorOpen)) else if (MoveInfo.IsStep(StepEnum.XW22_OutDoorOpen))
{ {
if (IOValue(IO_Type.Out_TrayCheck).Equals(IO_VALUE.HIGH)) var re = Out_TrayCheck_Test(RobotManager.robot.outputEquip.Config.CameraName, IO_VALUE.HIGH);
if (re.HasValue && re.Value)
{ {
MoveInfo.NextMoveStep(StepEnum.XW21_WaitOutNoReel); MoveInfo.NextMoveStep(StepEnum.XW21_WaitOutNoReel);
MoveInfo.TimeOutSeconds = 120; MoveInfo.TimeOutSeconds = 120;
WorkLog("料盘处理:XW22_OutDoorOpen后发现出口有料,再次等待出口无料盘"); WorkLog("料盘处理:XW22_OutDoorOpen后发现出口有料,再次等待出口无料盘");
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>((w) => { return Out_TrayCheck_Test(RobotManager.robot.outputEquip.Config.CameraName, IO_VALUE.LOW).GetValueOrDefault(); }), $"等待[Out_TrayCheck=Low]"));
} }
else else if (re.HasValue)
{ {
MoveInfo.NextMoveStep(StepEnum.XW23_OutLineRun); MoveInfo.NextMoveStep(StepEnum.XW23_OutLineRun);
WorkLog("料盘处理:中间皮带线,出口皮带线转动", 1); WorkLog("料盘处理:中间皮带线,出口皮带线转动", 1);
...@@ -354,13 +356,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -354,13 +356,13 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsStep(StepEnum.XW24_WaitOutCheck)) else if (MoveInfo.IsStep(StepEnum.XW24_WaitOutCheck))
{ {
if (IOValue(IO_Type.Out_TrayCheck).Equals(IO_VALUE.HIGH) || Out_TrayCheck_force) if (Out_TrayCheck_Test(RobotManager.robot.outputEquip.Config.CameraName, IO_VALUE.HIGH).GetValueOrDefault() || Out_TrayCheck_force)
{ {
MoveInfo.NextMoveStep(StepEnum.XW25_WaitTime); MoveInfo.NextMoveStep(StepEnum.XW25_WaitTime);
WorkLog("料盘处理: 中间皮带线先停止,出口皮带线 再转动3秒,挡停先下降"); WorkLog("料盘处理: 中间皮带线先停止,出口皮带线 再转动3秒,挡停先下降");
IOMove(IO_Type.X_MLine_Run, IO_VALUE.LOW); IOMove(IO_Type.X_MLine_Run, IO_VALUE.LOW);
IOMove(IO_Type.X_OLine_Run, IO_VALUE.HIGH, 3000); IOMove(IO_Type.X_OLine_Run, IO_VALUE.HIGH, 3000);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.HIGH)); //MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.HIGH));
CylinderMove(null, IO_Type.X_StopCylinder_Up, IO_Type.X_StopCylinder_Down); CylinderMove(null, IO_Type.X_StopCylinder_Up, IO_Type.X_StopCylinder_Down);
} }
...@@ -368,6 +370,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -368,6 +370,7 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.NextMoveStep(StepEnum.XW24_WaitOutCheck); MoveInfo.NextMoveStep(StepEnum.XW24_WaitOutCheck);
WorkLog("料盘处理:Out_TrayCheck X57没有检测到料盘"); WorkLog("料盘处理:Out_TrayCheck X57没有检测到料盘");
/*
var hasplate = TestPlate.TestIt(RobotManager.robot.outputEquip.Config.CameraName, saveone); var hasplate = TestPlate.TestIt(RobotManager.robot.outputEquip.Config.CameraName, saveone);
saveone = false; saveone = false;
if (!hasplate[0] && !hasplate[1]) if (!hasplate[0] && !hasplate[1])
...@@ -382,7 +385,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -382,7 +385,7 @@ namespace OnlineStore.DeviceLibrary
else { else {
WorkLog("料盘处理:图像检测到料盘,当作有料处理"); WorkLog("料盘处理:图像检测到料盘,当作有料处理");
//Out_TrayCheck_force = true; //Out_TrayCheck_force = true;
} }*/
} }
} }
else if (MoveInfo.IsStep(StepEnum.XW25_WaitTime)) else if (MoveInfo.IsStep(StepEnum.XW25_WaitTime))
......
using Asa.Camera;
using CodeLibrary;
using OnlineStore;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
public class HIKCamera
{
Thread camerathread;
//static HIKCamera _camera;
Asa.Camera.VisionLib camera;
//public static HIKCamera Current
//{
// get
// {
// if (_camera == null)
// _camera = new HIKCamera();
// return _camera;
// }
//}
public string Name = "";
public event EventHandler<Bitmap> camera_event;
public string DeviceName = "CameraA";
public bool LoadCameraConfig(string CameraID, out string msg)
{
Name = CameraID;
msg = "";
string path = $".\\Config\\{CameraID}.json";
if (!File.Exists(path))
{
msg = Name + "找不到监控相机配置文件";
LogUtil.error(Name + "找不到监控相机配置文件" + path);
return false;
}
try
{
var configtxt = File.ReadAllText(path);
if (configtxt.IndexOf("Pwd") > 0)
{
configtxt = configtxt.Replace("Pwd", "Password");
configtxt = configtxt.Replace("\"8000\"", "8000");
File.WriteAllText(path, configtxt);
}
var m = Regex.Match(configtxt, "name\".*?\"(.+)\"", RegexOptions.IgnoreCase);
DeviceName = m.Groups[1].Value;
camera = new VisionLib(path, true, "HIK.IPCamera");
}
catch (Exception e)
{
msg = Name + "加载监控相机配置文件失败:" + e.ToString();
LogUtil.error(Name + "加载监控相机配置文件失败:" + e.ToString());
return false;
}
for (int i = 0; i < 10; i++)
{
camera.Open(DeviceName);
Thread.Sleep(100);
Bitmap bmp = camera.GetImage(DeviceName);
if (bmp != null)
{
return true;
}
camera.Close(DeviceName);
Thread.Sleep(100);
}
msg = Name + "监控相机打开失败";
LogUtil.error(Name + $"监控相机打开失败");
return false;
//camerathread = new Thread(new ThreadStart(startCamera));
//camerathread.Start();
//GC.KeepAlive(camerathread);
}
int errortimes = 0;
bool camerathreadrun = true;
public void stopCamera() {
camerathreadrun = false;
}
void startCamera()
{
int errorsleeptime = 5000;
camerathreadrun = true;
while (camerathreadrun)
{
try
{
Bitmap bmp = camera.GetImage(DeviceName);
if (bmp != null)
{
errortimes = 0;
errorsleeptime = 5000;
camera_event?.Invoke(this, bmp);
}
else if (bmp == null && errortimes < 5)
{
errortimes++;
LogUtil.error(Name + $"相机获取图像出错,{errortimes}");
Thread.Sleep(errorsleeptime);
}
else if (errortimes == 5)
{
camera.Close(DeviceName);
Thread.Sleep(1000);
camera.Open(DeviceName);
errortimes=0;
errorsleeptime = errorsleeptime * 2;
LogUtil.error(Name + $"相机错误次数过多,重新打开,{errortimes}");
}
else if (errortimes == 6)
{
LogUtil.error(Name + $"相机连接失败, 相机线程退出,{errortimes}");
break;
}
Thread.Sleep(1000 / 5);
}
catch
{
errortimes++;
}
}
try
{
camera.Close(DeviceName);
}
catch { }
camera.Dispose();
}
public Bitmap CameraGrabOne() {
return camera.GetImage(DeviceName);
}
public void CameraGrabOne(string filename)
{
try
{
LogUtil.info(Name + "库位文件名:" + filename);
Bitmap bmp = camera.GetImage(DeviceName);
if (bmp != null)
{
if (File.Exists(filename))
File.Delete(filename);
bmp.Save(filename, ImageFormat.Jpeg);
bmp.Dispose();
}
}
catch (Exception e)
{
LogUtil.error(Name + e.ToString());
}
}
}
public enum FixtureState
{
FromIn,
FromOut,
FromInSide,
FromOutSide,
ToIn,
ToOut,
ToInSide,
ToOutSide,
ToFix,
}
...@@ -7,6 +7,7 @@ using System.Drawing; ...@@ -7,6 +7,7 @@ using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection.Emit;
using System.Runtime.ExceptionServices; using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
...@@ -152,58 +153,32 @@ namespace OnlineStore.DeviceLibrary ...@@ -152,58 +153,32 @@ namespace OnlineStore.DeviceLibrary
CamErrCount[deviceName] = 0; CamErrCount[deviceName] = 0;
LogUtil.debug(deviceName + " 【" + cameraName + "】取图片完成,开始扫码"); LogUtil.debug(deviceName + " 【" + cameraName + "】取图片完成,开始扫码");
string r = ""; string r = "";
RemoteDecodeHelper.RemoteDecodeParam remoteDecodeParam = new RemoteDecodeHelper.RemoteDecodeParam
List<CodeInfo> tlci = EyemDecode2.Decoder(ref bmp);
foreach (CodeInfo code in tlci) {
LogUtil.info(deviceName + " 【" + cameraName + "】[eyemDecode]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr);
string str = CodeManager.ReplaceCode(code.CodeStr);
if (!codeList.Contains(str))
{
codeList.Add(str);
r = r + "##eyemDecode|" + code.CodeType + "|" + str;
if (!findRightCode)
{
findRightCode = HasRightCode(str);
}
if (HasRightCode(str) && ccall.FindAll(x=> x.CodeStr == str).Count()==0)
ccall.Add(code);
}
}
if (!findRightCode)
{ {
foreach (string codeType in codeTypeList) codeTypeList = codeTypeList.ToArray(),
codeCount = codeCount,
timeout = 2500
};
cc = RemoteDecodeHelper.DecodeRequest(bmp, remoteDecodeParam);
if (cc != null && cc.Count > 0) {
foreach (CodeInfo c in cc)
{ {
//判断是否是一维码 string str = CodeManager.ReplaceCode(c.CodeStr);
if (codeType.ToLower().Equals("barcode")) if (!codeList.Contains(str))
{ {
cc = HDCodeHelper.DecodeBarCode(ho_Image); codeList.Add(str);
} r = r + "|" + c.CodeType + "|" + str;
else
{
cc = HDCodeHelper.DecodeCode(ho_Image, codeType, GetCodeParamFilePath(codeType), codeCount, 2500);
}
foreach (CodeInfo c in cc) if (!findRightCode)
{
string str = CodeManager.ReplaceCode(c.CodeStr);
if (!codeList.Contains(str))
{ {
codeList.Add(str); findRightCode = HasRightCode(str);
r = r + "##Halcon|" + codeType + "|" + str; if (findRightCode)
if (!findRightCode)
{ {
findRightCode = HasRightCode(str); ccall.Add(c);
if (findRightCode) ///nosave = false;
{
ccall.Add(c);
nosave = false;
}
} }
//if (HasRightCode(str) && ccall.FindAll(x => x.CodeStr == str).Count() == 0)
} }
//if (HasRightCode(str) && ccall.FindAll(x => x.CodeStr == str).Count() == 0)
} }
} }
} }
......
...@@ -24,7 +24,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -24,7 +24,7 @@ namespace OnlineStore.DeviceLibrary
public static RobotBean robot = null; public static RobotBean robot = null;
public static Robot_Config Config = null; public static Robot_Config Config = null;
public static Dictionary<int, DeviceConfig> allConfigMap = null; public static Dictionary<int, DeviceConfig> allConfigMap = null;
public static HIKCamera CameraA = new HIKCamera();
public RobotManager() public RobotManager()
{ {
} }
...@@ -46,6 +46,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -46,6 +46,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
} }
public static bool Camera_Out_TrayCheck_Test = true;
public static bool Init() public static bool Init()
{ {
try try
...@@ -91,8 +92,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -91,8 +92,17 @@ namespace OnlineStore.DeviceLibrary
outconfig.SetIO(subType); outconfig.SetIO(subType);
allConfigMap.Add(subType, outconfig); allConfigMap.Add(subType, outconfig);
ACServerManager.LogEvent += ACServerManager_LogEvent; ACServerManager.LogEvent += ACServerManager_LogEvent;
if (!CameraA.LoadCameraConfig("CameraA", out string errmsg))
{
LogUtil.info("监控相机加载出错!");
Camera_Out_TrayCheck_Test = false;
}
robot = new RobotBean(Config, inputConfig, XrayConfig, outconfig); robot = new RobotBean(Config, inputConfig, XrayConfig, outconfig);
InitPrint(); InitPrint();
LogUtil.info("加载 完成!"); LogUtil.info("加载 完成!");
return true; return true;
......
...@@ -291,6 +291,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -291,6 +291,14 @@ namespace OnlineStore.DeviceLibrary
wait.WaitType = WaitEnum.W301_DLineScanCode; wait.WaitType = WaitEnum.W301_DLineScanCode;
return wait; return wait;
} }
public static WaitResultInfo WaitAction(Func<WaitResultInfo, bool> a, string msg)
{
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = WaitEnum.W013_Action;
wait.Action = a;
wait.ActionMsg = msg;
return wait;
}
public string ToStr() public string ToStr()
{ {
if (WaitType.Equals(WaitEnum.W001_AxisMove)) if (WaitType.Equals(WaitEnum.W001_AxisMove))
...@@ -403,7 +411,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -403,7 +411,11 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public int HeightValue { get; set; } public int HeightValue { get; set; }
/// <summary>
/// 等待事件代理
/// </summary>
public Func<WaitResultInfo, bool> Action { get; set; }
public string ActionMsg { get; set; }
} }
internal class WaitEnum internal class WaitEnum
{ {
...@@ -431,6 +443,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -431,6 +443,8 @@ namespace OnlineStore.DeviceLibrary
/// 轴原点信号 /// 轴原点信号
/// </summary> /// </summary>
internal static int W006_AxisOrg = 6; internal static int W006_AxisOrg = 6;
internal static int W013_Action = 7;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.LoadCSVLibrary</RootNamespace> <RootNamespace>OnlineStore.LoadCSVLibrary</RootNamespace>
<AssemblyName>LoadCSVLibrary</AssemblyName> <AssemblyName>LoadCSVLibrary</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
......
...@@ -19,7 +19,7 @@ namespace UserFromControl.Properties { ...@@ -19,7 +19,7 @@ namespace UserFromControl.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。 // (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources { internal class Resources {
...@@ -47,8 +47,8 @@ namespace UserFromControl.Properties { ...@@ -47,8 +47,8 @@ namespace UserFromControl.Properties {
} }
/// <summary> /// <summary>
/// 使用此强类型资源类,为所有资源查找 /// 重写当前线程的 CurrentUICulture 属性,对
/// 重写当前线程的 CurrentUICulture 属性 /// 使用此强类型资源类的所有资源查找执行重写
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture { internal static global::System.Globalization.CultureInfo Culture {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UserFromControl</RootNamespace> <RootNamespace>UserFromControl</RootNamespace>
<AssemblyName>UserFromControl</AssemblyName> <AssemblyName>UserFromControl</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!