Commit 18028b8a 张东亮

codelibrary的log4net版本不一致问题处理

1 个父辈 d20ac852
此文件类型无法预览
<?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="0"/> <add key="App_AutoRun" value="0"/>
<add key="App_Title" value="流水线客户端"/> <add key="App_Title" value="流水线客户端"/>
<!--Server address--> <!--Server address-->
<!--<add key="http.server" value="http://localhost/myproject/service/store/emptyPosForPutin"/>--> <!--<add key="http.server" value="http://localhost/myproject/service/store/emptyPosForPutin"/>-->
<add key="http.server" value="http://10.85.199.25/myproject/"/> <add key="http.server" value="http://10.85.199.25/myproject/"/>
<!--storeType--> <!--storeType-->
<add key="Line_moveEquip_count" value="24"/> <add key="Line_moveEquip_count" value="24"/>
<add key="Line_feedingEquip_count" value="5"/> <add key="Line_feedingEquip_count" value="5"/>
<add key="Line_HYEquip_count" value="21"/> <add key="Line_HYEquip_count" value="21"/>
<!--<add key="Line_dischargeLine_count" value="2" />--> <!--<add key="Line_dischargeLine_count" value="2" />-->
<!--start one store config--> <!--start one store config-->
<add key="ConfigPath_Line" value="\LineConfig\Config_Line.csv"/> <add key="ConfigPath_Line" value="\LineConfig\Config_Line.csv"/>
<add key="ConfigPath_MoveEquip" value="\LineConfig\MoveEquip\Config_MoveEquip.csv"/> <add key="ConfigPath_MoveEquip" value="\LineConfig\MoveEquip\Config_MoveEquip.csv"/>
<add key="ConfigPath_FeedingEquip" value="\LineConfig\Config_FeedingEquip.csv"/> <add key="ConfigPath_FeedingEquip" value="\LineConfig\Config_FeedingEquip.csv"/>
<add key="ConfigPath_HYEquip" value="\LineConfig\HY\Config_HYEquip.csv"/> <add key="ConfigPath_HYEquip" value="\LineConfig\HY\Config_HYEquip.csv"/>
<add key="ConfigPath_DischargeLine" value="\LineConfig\Config_DischargeLine.csv"/> <add key="ConfigPath_DischargeLine" value="\LineConfig\Config_DischargeLine.csv"/>
<add key="ConfigPath_TrayList" value="\LineConfig\TrayList.data"/> <add key="ConfigPath_TrayList" value="\LineConfig\TrayList.data"/>
<add key="Line_Type" value="Line"/> <add key="Line_Type" value="Line"/>
<add key="Line_CID" value="so664"/> <add key="Line_CID" value="so664"/>
<!--end one store config--> <!--end one store config-->
<!--摄像机名称列表配置,用#分割--> <!--摄像机名称列表配置,用#分割-->
<add key="CameraName" value="GigE:MV-CE100-30GC (00C69898519)#GigE:MV-CE100-30GC (00C95305929)"/> <add key="CameraName" value="GigE:MV-CE100-30GC (00C69898519)#GigE:MV-CE100-30GC (00C95305929)"/>
<!--二维码类型列表配置,用#分割,一维码=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\"/> <add key="CodeParamPath" value="\CodeParam\"/>
<add key="Config_Pwd" value="123456"/> <add key="Config_Pwd" value="123456"/>
<!--出库等待料盘拿走的时间,秒--> <!--出库等待料盘拿走的时间,秒-->
<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"/>
<!--AGV调度服务器地址--> <!--AGV调度服务器地址-->
<add key="AgvServerIp" value="10.85.162.40"/> <add key="AgvServerIp" value="10.85.162.40"/>
<!--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"/>
<!--ABB机器人服务器--> <!--ABB机器人服务器-->
<add key="ABBServerPort" value="21"/> <add key="ABBServerPort" value="21"/>
<!--是否打开托盘编码界面--> <!--是否打开托盘编码界面-->
<add key="OpenRFIDWrite" value="1"/> <add key="OpenRFIDWrite" 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="4"/> <add key="CodeCount" value="4"/>
<add key="DefaultTrayNum" value="0"/> <add key="DefaultTrayNum" value="0"/>
<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="NeedCheckTray" value="0"/> <add key="NeedCheckTray" value="0"/>
<add key="Feed_LastShelfID_101" value="B19"/> <add key="Feed_LastShelfID_101" value="B19"/>
<add key="Feed_LastShelfID_102" value="B23"/> <add key="Feed_LastShelfID_102" value="B23"/>
<add key="Feed_LastShelfID_103" value="B25"/> <add key="Feed_LastShelfID_103" value="B25"/>
<add key="Feed_LastShelfID_104" value="B7"/> <add key="Feed_LastShelfID_104" value="B7"/>
<add key="SaveErrorImageToFile" value="1"/> <add key="SaveErrorImageToFile" value="1"/>
<add key="UseHCBoard" value="1"/> <add key="UseHCBoard" value="1"/>
<add key="ShowIOForm" value="1"/> <add key="ShowIOForm" value="1"/>
<add key="RfidServer_Port" value="12001"/> <add key="RfidServer_Port" value="12001"/>
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/Line-SO664.log"/> <file value="logs/Line-SO664.log"/>
<param name="Encoding" value="UTF-8"/> <param name="Encoding" value="UTF-8"/>
<param name="maxSizeRollBackups" value="100"/> <param name="maxSizeRollBackups" value="100"/>
<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-line.log"/> <file value="logs/rfid/TheRFID-line.log"/>
<param name="Encoding" value="UTF-8"/> <param name="Encoding" value="UTF-8"/>
<param name="maxSizeRollBackups" value="3"/> <param name="maxSizeRollBackups" value="3"/>
<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-line.log"/> <file value="logs/aio/AIOBOX-line.log"/>
<param name="Encoding" value="UTF-8"/> <param name="Encoding" value="UTF-8"/>
<param name="maxSizeRollBackups" value="100"/> <param name="maxSizeRollBackups" value="100"/>
<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="RunLog" type="log4net.Appender.RollingFileAppender"> <appender name="RunLog" type="log4net.Appender.RollingFileAppender">
<file value="logs/log/RunLog-line.log"/> <file value="logs/log/RunLog-line.log"/>
<param name="Encoding" value="UTF-8"/> <param name="Encoding" value="UTF-8"/>
<param name="maxSizeRollBackups" value="100"/> <param name="maxSizeRollBackups" value="100"/>
<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=" %m%n"/> <conversionPattern value=" %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="Error"/> <level value="Error"/>
<appender-ref ref="TheRFID"/> <appender-ref ref="TheRFID"/>
</logger> </logger>
<logger name="AIOBOX"> <logger name="AIOBOX">
<level value="Info"/> <level value="Info"/>
<appender-ref ref="AIOBOX"/> <appender-ref ref="AIOBOX"/>
</logger> </logger>
<logger name="RunLog"> <logger name="RunLog">
<level value="Info"/> <level value="Info"/>
<appender-ref ref="RunLog"/> <appender-ref ref="RunLog"/>
</logger> </logger>
<!--<root> <!--<root>
<level value="Info" /> <level value="Info" />
<appender-ref ref="RollingLogFileAppender" /> <appender-ref ref="RollingLogFileAppender" />
</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.1"/>
</startup> </startup>
<!--<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<codebase version="2.0.8" href="log4net\2.0.8\log4net.dll" />
<codeBase version="2.0.12" href="log4net\2.0.12\log4net.dll" />
</dependentAssembly>
</assemblyBinding>
</runtime>-->
</configuration> </configuration>
...@@ -58,8 +58,9 @@ ...@@ -58,8 +58,9 @@
<Reference Include="Client"> <Reference Include="Client">
<HintPath>..\..\dll\Client.dll</HintPath> <HintPath>..\..\dll\Client.dll</HintPath>
</Reference> </Reference>
<Reference Include="CodeLibrary"> <Reference Include="CodeLibrary, Version=1.0.8773.17945, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\SharedRefDll\Neotel\CodeLibrary\CodeLibrary.dll</HintPath>
</Reference> </Reference>
<Reference Include="halcondotnet"> <Reference Include="halcondotnet">
<HintPath>..\..\dll\halcondotnet.dll</HintPath> <HintPath>..\..\dll\halcondotnet.dll</HintPath>
......
using CodeLibrary; using CodeLibrary;
using log4net;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.DeviceLibrary; using OnlineStore.DeviceLibrary;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace OnlineStore.AssemblyLine namespace OnlineStore.AssemblyLine
......
...@@ -12,7 +12,7 @@ namespace OnlineStore.AssemblyLine.Properties { ...@@ -12,7 +12,7 @@ namespace OnlineStore.AssemblyLine.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.8.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())));
......
...@@ -46,14 +46,19 @@ ...@@ -46,14 +46,19 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\Client.dll</HintPath> <HintPath>..\..\dll\Client.dll</HintPath>
</Reference> </Reference>
<Reference Include="CodeLibrary"> <Reference Include="CodeLibrary, Version=1.0.8836.19057, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\SharedRefDll\Neotel\CodeLibrary\CodeLibrary.dll</HintPath>
</Reference> </Reference>
<Reference Include="ConfigHelper"> <Reference Include="ConfigHelper">
<HintPath>..\..\..\..\..\..\SharedRefDll\Neotel\ConfigHelper\Debug\net461\ConfigHelper.dll</HintPath> <HintPath>..\..\..\..\..\..\SharedRefDll\Neotel\ConfigHelper\Debug\net461\ConfigHelper.dll</HintPath>
</Reference> </Reference>
<Reference Include="halcondotnet"> <Reference Include="DL.Log">
<HintPath>..\..\dll\halcondotnet.dll</HintPath> <HintPath>..\..\..\..\..\..\SharedRefDll\Neotel\DL.Log\Debug\netstandard2.0\DL.Log.dll</HintPath>
</Reference>
<Reference Include="halcondotnet, Version=12.0.0.0, Culture=neutral, PublicKeyToken=4973bed59ddbf2b8, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\SharedRefDll\halcon\12.0.0.0\x86\halcondotnet.dll</HintPath>
</Reference> </Reference>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
...@@ -125,33 +130,15 @@ ...@@ -125,33 +130,15 @@
<Compile Include="server\LineServer.cs" /> <Compile Include="server\LineServer.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="eyemLib.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="halcon.dll"> <Content Include="halcon.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="libdecode.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="libdmtx.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="MvCameraControl.Net.dll"> <Content Include="MvCameraControl.Net.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="MvCameraControl.Net.xml"> <Content Include="MvCameraControl.Net.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="opencv_world420.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="tbb.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="zxing.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Common\Common.csproj"> <ProjectReference Include="..\Common\Common.csproj">
......
using CodeLibrary; using CodeLibrary;
using OnlineStore.Common; using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -16,10 +16,41 @@ namespace OnlineStore.DeviceLibrary ...@@ -16,10 +16,41 @@ namespace OnlineStore.DeviceLibrary
{ {
public class CodeManager public class CodeManager
{ {
public static List<string> allCodeTypeList = new List<string>(); public static List<string> allCodeTypeList = new List<string>();
public static List<string> balserNameList = new List<string>(); public static List<string> balserNameList = new List<string>();
public static List<string> hikNameList = new List<string>(); public static List<string> hikNameList = new List<string>();
static CodeManager()
{
HDLogUtil.Log.LogEvent += LOGGER_LogEvent;
}
private static void LOGGER_LogEvent(DL.Log.LogEventArgs args)
{
switch (args.LogLevel)
{
case DL.Log.LogLevel.Debug:
LogUtil.debug(args.ToString());
break;
case DL.Log.LogLevel.Info:
LogUtil.info(args.ToString());
break;
case DL.Log.LogLevel.Warn:
LogUtil.error(args.ToString());
break;
case DL.Log.LogLevel.Error:
LogUtil.error(args.ToString());
break;
case DL.Log.LogLevel.Fatal:
LogUtil.error(args.ToString());
break;
}
}
private static char spiltChar = '#'; private static char spiltChar = '#';
/// <summary> /// <summary>
/// 初始化摄像机名称和二维码类型 /// 初始化摄像机名称和二维码类型
...@@ -28,7 +59,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -28,7 +59,6 @@ namespace OnlineStore.DeviceLibrary
{ {
string codeStr = ConfigAppSettings.GetValue(Setting_Init.CodeType); string codeStr = ConfigAppSettings.GetValue(Setting_Init.CodeType);
allCodeTypeList = new List<string>(); allCodeTypeList = new List<string>();
HDLogUtil.LogName = "RollingLogFileAppender";
try try
{ {
string[] codeArray = codeStr.Split(spiltChar); string[] codeArray = codeStr.Split(spiltChar);
...@@ -43,7 +73,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -43,7 +73,6 @@ namespace OnlineStore.DeviceLibrary
} }
LoadCamera(false); LoadCamera(false);
CodeLibrary.HDCodeLearnHelper.LoadConfig("", codeStr);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -52,7 +81,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -52,7 +81,7 @@ namespace OnlineStore.DeviceLibrary
} }
private static void LoadCamera(bool isReLoad) private static void LoadCamera(bool isReLoad)
{ {
if (isReLoad|| Camera._cam==null) if (isReLoad || Camera._cam == null)
{ {
try try
{ {
...@@ -60,13 +89,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -60,13 +89,13 @@ namespace OnlineStore.DeviceLibrary
{ {
Camera._cam.CloseAll(); Camera._cam.CloseAll();
} }
Camera.Type = CameraType.HIK; Camera.Type = CameraType.HIK;
Camera._cam.Load(); Camera._cam.Load();
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("加载HIK相机出错:", ex); LogUtil.error("加载HIK相机出错:", ex);
} }
} }
string[] names = Camera._cam.Name; string[] names = Camera._cam.Name;
...@@ -85,7 +114,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -85,7 +114,7 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.info("加载到HIK相机:" + name); LogUtil.info("加载到HIK相机:" + name);
} }
} }
} }
public static void CloseCamera(string cameraName) public static void CloseCamera(string cameraName)
...@@ -93,15 +122,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -93,15 +122,15 @@ namespace OnlineStore.DeviceLibrary
Camera._cam.Close(cameraName); Camera._cam.Close(cameraName);
} }
public static void CloseAllCamera() public static void CloseAllCamera()
{ {
Camera._cam.CloseAll(); Camera._cam.CloseAll();
} }
private static int ScanCount = 0; private static int ScanCount = 0;
private static int codeCount = ConfigAppSettings.GetIntValue(Setting_Init.CodeCount); private static int codeCount = ConfigAppSettings.GetIntValue(Setting_Init.CodeCount);
[HandleProcessCorruptedStateExceptions] [HandleProcessCorruptedStateExceptions]
public static List<string> CameraScan(List<string> cameraList, string deviceName, bool findRightCodeBreak = false, int timeOut = 1500) public static List<string> CameraScan(List<string> cameraList, string deviceName, bool findRightCodeBreak = false, int timeOut = 1500)
{ {
bool isPreScan = deviceName.EndsWith("预扫码"); bool isPreScan = deviceName.EndsWith("预扫码");
List<string> codeList = new List<string>(); List<string> codeList = new List<string>();
if (cameraList == null || cameraList.Count <= 0) if (cameraList == null || cameraList.Count <= 0)
{ {
...@@ -269,7 +298,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -269,7 +298,7 @@ namespace OnlineStore.DeviceLibrary
} }
return codeList; return codeList;
} }
private static int SaveErrorImageToFile = ConfigAppSettings.GetIntValue(Setting_Init.SaveErrorImageToFile); private static int SaveErrorImageToFile = ConfigAppSettings.GetIntValue(Setting_Init.SaveErrorImageToFile);
private static void SaveImageToFile(string deviceName, string cameraName, HalconDotNet.HObject bitmap) private static void SaveImageToFile(string deviceName, string cameraName, HalconDotNet.HObject bitmap)
{ {
...@@ -293,7 +322,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -293,7 +322,7 @@ namespace OnlineStore.DeviceLibrary
} }
private static void SaveImageToFile(string deviceName, string cameraName, Bitmap bitmap) private static void SaveImageToFile(string deviceName, string cameraName, Bitmap bitmap)
{ {
string date = deviceName.Trim().Replace('_', '-') +"-"+ DateTime.Now.ToString("HH-mm-ss-") + DateTime.Now.Millisecond; string date = deviceName.Trim().Replace('_', '-') + "-" + DateTime.Now.ToString("HH-mm-ss-") + DateTime.Now.Millisecond;
string dire = @"D:\image\" + deviceName.Trim().Replace('_', '-') + @"\" + cameraName.Trim().Replace('_', '-').Replace(':', '-') + @"\"; string dire = @"D:\image\" + deviceName.Trim().Replace('_', '-') + @"\" + cameraName.Trim().Replace('_', '-').Replace(':', '-') + @"\";
string iamgeName = date + ".bmp"; string iamgeName = date + ".bmp";
try try
...@@ -312,7 +341,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -312,7 +341,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
public static bool HasRightCode(params string[] codes) public static bool HasRightCode(params string[] codes)
{ {
//分号分割后长度=4,L,E,B,R //分号分割后长度=4,L,E,B,R
try try
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!