Commit 62e13569 LN

西安料仓增加zxing识别二维码

1 个父辈 09248790
此文件类型无法预览
...@@ -9,9 +9,24 @@ ...@@ -9,9 +9,24 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.ACSingleStore</RootNamespace> <RootNamespace>OnlineStore.ACSingleStore</RootNamespace>
<AssemblyName>ACSingleStore</AssemblyName> <AssemblyName>ACSingleStore</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
...@@ -244,6 +259,13 @@ ...@@ -244,6 +259,13 @@
<ItemGroup> <ItemGroup>
<WCFMetadata Include="Connected Services\" /> <WCFMetadata Include="Connected Services\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.
......
<?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="AC_SA_料仓_1" /> <add key="App_Title" value="AC_SA_料仓_1"/>
<add key="scanner_start_command" value="S" /> <add key="scanner_start_command" value="S"/>
<!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)--> <!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)-->
<add key="StartBlowValue" value="4" /> <add key="StartBlowValue" value="4"/>
<!-- 停止吹气的判断值(配置值=服务器发送的湿度值-停止吹气值)--> <!-- 停止吹气的判断值(配置值=服务器发送的湿度值-停止吹气值)-->
<add key="StopBlowValue" value="4" /> <add key="StopBlowValue" value="4"/>
<!--Server address--> <!--Server address-->
<!--<add key="http.server" value="http://localhost:80/"/>--> <!--<add key="http.server" value="http://localhost:80/"/>-->
<!--storeType--> <!--storeType-->
<add key="store_count" value="1" /> <add key="store_count" value="1"/>
<!--start one store config--> <!--start one store config-->
<add key="Store_Position_Config" value="\StoreConfig\AC\linePositions.csv" /> <add key="Store_Position_Config" value="\StoreConfig\AC\linePositions.csv"/>
<add key="Store_ConfigPath" value="\StoreConfig\AC\StoreConfig.csv" /> <add key="Store_ConfigPath" value="\StoreConfig\AC\StoreConfig.csv"/>
<add key="Store_Type" value="RC_AC_SA" /> <add key="Store_Type" value="RC_AC_SA"/>
<add key="Store_CID" value="rc29ac-1" /> <add key="Store_CID" value="rc29ac-1"/>
<!--end one store config--> <!--end one store config-->
<!--摄像机名称列表配置,用#分割--> <!--摄像机名称列表配置,用#分割-->
<add key="CameraName" value="GigE:MV-CE100-30GC (00C69898483)" /> <add key="CameraName" value="GigE:MV-CE100-30GC (00C69898483)"/>
<!--二维码类型列表配置,用#分割,一维码=Barcode--> <!--二维码类型列表配置,用#分割,一维码=Barcode-->
<add key="CodeType" value="QR Code#Data Matrix ECC 200#Micro QR Code" /> <add key="CodeType" value="QR Code#Data Matrix ECC 200#Micro QR Code"/>
<!--<add key="CodeType" value="Data Matrix ECC 200"/>--> <!--<add key="CodeType" value="Data Matrix ECC 200"/>-->
<!--二维码参数文件所在路径,文件名与二维码类型名一样--> <!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<add key="CodeParamPath" value="\CodeParam\" /> <add key="CodeParamPath" value="\CodeParam\"/>
<add key ="AI_ConvertPosition" value ="55"/> <add key="AI_ConvertPosition" value="55"/>
<add key ="InOutDefaultPosition" value ="8000"/> <add key="InOutDefaultPosition" value="8000"/>
<add key ="Config_Pwd" value ="123456"/> <add key="Config_Pwd" value="123456"/>
<!--出库等待料盘拿走的时间,秒--> <!--出库等待料盘拿走的时间,秒-->
<add key ="OutStoreWaitSeconds" value ="10"/> <add key="OutStoreWaitSeconds" value="10"/>
<!--压紧轴对应1mm的脉冲--> <!--压紧轴对应1mm的脉冲-->
<add key="ComAxisChangeValue" value="2400" /> <add key="ComAxisChangeValue" value="2400"/>
<!--温控器类型,0=壁挂王字壳温湿度变送器,1=妙昕温湿度记录仪--> <!--温控器类型,0=壁挂王字壳温湿度变送器,1=妙昕温湿度记录仪-->
<add key ="HumitureControllerType" value ="1"/> <add key="HumitureControllerType" value="1"/>
<!--流水线地址和端口配置--> <!--流水线地址和端口配置-->
<add key ="LineServerIp" value ="192.168.200.69"/> <add key="LineServerIp" value="192.168.200.69"/>
<add key ="LineServerPort" value ="1234"/> <add key="LineServerPort" value="1234"/>
<!--解码方式,0=halcon 解码,1=使用zxing解码-->
<add key="DeCodeType" value="1"/>
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/ACStore-RC29-1.log" /> <file value="logs/ACStore-RC29-1.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>
<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.0" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup> </startup>
<!-- 部署服务库项目时,必须将配置文件的内容添加到 <!-- 部署服务库项目时,必须将配置文件的内容添加到
主机的 app.config 文件中。System.Configuration 不支持库的配置文件。 --> 主机的 app.config 文件中。System.Configuration 不支持库的配置文件。 -->
...@@ -70,14 +72,14 @@ ...@@ -70,14 +72,14 @@
<service name="AcStoreWCF.CWSMDBox"> <service name="AcStoreWCF.CWSMDBox">
<endpoint address="" binding="basicHttpBinding" contract="AcStoreWCF.ICWSMDBox"> <endpoint address="" binding="basicHttpBinding" contract="AcStoreWCF.ICWSMDBox">
<identity> <identity>
<dns value="localhost" /> <dns value="localhost"/>
</identity> </identity>
</endpoint> </endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host> <host>
<baseAddresses> <baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/AcStoreWCF/CWSMDBox/" /> <add baseAddress="http://localhost:8733/Design_Time_Addresses/AcStoreWCF/CWSMDBox/"/>
</baseAddresses> </baseAddresses>
</host> </host>
</service> </service>
...@@ -87,13 +89,13 @@ ...@@ -87,13 +89,13 @@
<behavior> <behavior>
<!-- 为避免泄漏元数据信息, <!-- 为避免泄漏元数据信息,
请在部署前将以下值设置为 false --> 请在部署前将以下值设置为 false -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" /> <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
<!-- 要接收故障异常详细信息以进行调试, <!-- 要接收故障异常详细信息以进行调试,
请将以下值设置为 true。在部署前设置为 false 请将以下值设置为 true。在部署前设置为 false
以避免泄漏异常信息 --> 以避免泄漏异常信息 -->
<serviceDebug includeExceptionDetailInFaults="False" /> <serviceDebug includeExceptionDetailInFaults="False"/>
</behavior> </behavior>
</serviceBehaviors> </serviceBehaviors>
</behaviors> </behaviors>
</system.serviceModel> </system.serviceModel>
</configuration>
\ No newline at end of file \ No newline at end of file
</configuration>
...@@ -47,7 +47,7 @@ namespace OnlineStore.ACSingleStore.Properties { ...@@ -47,7 +47,7 @@ namespace OnlineStore.ACSingleStore.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)]
......
...@@ -12,7 +12,7 @@ namespace OnlineStore.ACSingleStore.Properties { ...@@ -12,7 +12,7 @@ namespace OnlineStore.ACSingleStore.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.6.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.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())));
......
...@@ -76,11 +76,13 @@ ...@@ -76,11 +76,13 @@
FA开头的二维码,默认为7*32 FA开头的二维码,默认为7*32
20190606 20190606
进入IO界面需要一直读取测高值。 进入IO界面需要一直读取测高值。
压紧轴回原点增加自动重复运动功能。 压紧轴回原点增加自动重复运动功能。
20190730
RC29项目西安料仓扫码需要用zxing才能识别,增加配置
<!--解码方式,0=halcon 解码,1=使用zxing解码-->
<add key="DeCodeType" value="1"/>
......
...@@ -84,5 +84,10 @@ namespace OnlineStore.Common ...@@ -84,5 +84,10 @@ namespace OnlineStore.Common
/// 温控器类型,0=壁挂王字壳温湿度变送器,1=妙昕温湿度记录仪 /// 温控器类型,0=壁挂王字壳温湿度变送器,1=妙昕温湿度记录仪
/// </summary> /// </summary>
public static string HumitureControllerType = "HumitureControllerType"; public static string HumitureControllerType = "HumitureControllerType";
/// <summary>
/// 解码类型,0=halcon,1=zxing解码
/// </summary>
public static string DeCodeType = "DeCodeType";
} }
} }
...@@ -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.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="CodeLibrary"> <Reference Include="CodeLibrary">
<HintPath>..\..\..\RC32-SZBOSCH-ACSingleStore\dll\CodeLibrary.dll</HintPath> <HintPath>..\..\dll\CodeLibrary.dll</HintPath>
</Reference> </Reference>
<Reference Include="halcondotnet"> <Reference Include="halcondotnet">
<HintPath>..\..\..\RC32-SZBOSCH-ACSingleStore\dll\halcondotnet.dll</HintPath> <HintPath>..\..\..\RC32-SZBOSCH-ACSingleStore\dll\halcondotnet.dll</HintPath>
...@@ -54,6 +54,9 @@ ...@@ -54,6 +54,9 @@
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="zxing">
<HintPath>..\..\dll\zxing.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="acSingleStore\AC_SA_BoxBean.cs" /> <Compile Include="acSingleStore\AC_SA_BoxBean.cs" />
......
...@@ -1372,7 +1372,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1372,7 +1372,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(LOGGER, StoreName + "没有收到二维码信息,请重新放入料盘"); LogUtil.info(LOGGER, StoreName + "没有收到二维码信息,请重新放入料盘");
return; return;
} }
IsNotScanCode = false; IsNotScanCode = false;
if (storeRunStatus.Equals(StoreRunStatus.Wait)) if (storeRunStatus.Equals(StoreRunStatus.Wait))
{ {
...@@ -1528,6 +1528,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -1528,6 +1528,10 @@ namespace OnlineStore.DeviceLibrary
message = ""; message = "";
} }
KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW); KNDIOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW);
if (CodeManager.DeCodeType.Equals(1))
{
message = "=1+0x0-" + GetSize() + "x" + height + "=" + CodeManager.GetBarcode(message);
}
onCodeReceived(message); onCodeReceived(message);
} }
......
...@@ -19,7 +19,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -19,7 +19,7 @@ namespace OnlineStore.DeviceLibrary
public static int CurrInOutType = 0; public static int CurrInOutType = 0;
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static AC_SA_BoxBean Store = null; public static AC_SA_BoxBean Store = null;
public static AC_SA_Config Config = null; public static AC_SA_Config Config = null;
......
using CodeLibrary; 
using OnlineStore.Common; using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -8,11 +8,12 @@ using System.Linq; ...@@ -8,11 +8,12 @@ using System.Linq;
using System.Runtime.ExceptionServices; using System.Runtime.ExceptionServices;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using CodeLibrary;
namespace OnlineStore.DeviceLibrary namespace OnlineStore.DeviceLibrary
{ {
public class CodeManager public class CodeManager
{ {
public static int DeCodeType = ConfigAppSettings.GetIntValue(Setting_Init.DeCodeType);
public static List<string> cameraNameList = new List<string>(); public static List<string> cameraNameList = new List<string>();
public static List<string> codeTypeList = new List<string>(); public static List<string> codeTypeList = new List<string>();
...@@ -163,31 +164,43 @@ namespace OnlineStore.DeviceLibrary ...@@ -163,31 +164,43 @@ namespace OnlineStore.DeviceLibrary
LogUtil.debug(" 摄像机【" + cameraName + "】获取图片完成"); LogUtil.debug(" 摄像机【" + cameraName + "】获取图片完成");
System.Threading.Thread.Sleep(1); System.Threading.Thread.Sleep(1);
HalconDotNet.HObject ho_Image = HDCodeHelper.Bitmap2HObjectBpp24(bitmap); if (DeCodeType.Equals(0))
LogUtil.debug(" 摄像机【" + cameraName + "】转换图片完成,开始扫码");
List<CodeInfo> cc = new List<CodeInfo>();
foreach (string codeType in codeTypeList)
{ {
//判断是否是一维码 HalconDotNet.HObject ho_Image = HDCodeHelper.Bitmap2HObjectBpp24(bitmap);
if (codeType.ToLower().Equals("barcode")) LogUtil.debug(" 摄像机【" + cameraName + "】转换图片完成,开始扫码");
{ List<CodeInfo> cc = new List<CodeInfo>();
cc = HDCodeHelper.DecodeBarCode(ho_Image); foreach (string codeType in codeTypeList)
}
else
{ {
cc = HDCodeHelper.DecodeCode(ho_Image, 1, GetCodeParamFilePath(codeType), codeType); //判断是否是一维码
} if (codeType.ToLower().Equals("barcode"))
if (cc.Count > 0) {
{ cc = HDCodeHelper.DecodeBarCode(ho_Image);
string r = ""; }
foreach (CodeInfo c in cc) else
{ {
codeList.Add(c.CodeStr); cc = HDCodeHelper.DecodeCode(ho_Image, 1, GetCodeParamFilePath(codeType), codeType);
r = r + "##" + c.CodeStr; }
if (cc.Count > 0)
{
string r = "";
foreach (CodeInfo c in cc)
{
codeList.Add(c.CodeStr);
r = r + "##" + c.CodeStr;
}
LogUtil.info(" 【" + cameraName + "】【" + codeType + "】扫码完成:" + r);
} }
LogUtil.info(" 【" + cameraName + "】【" + codeType + "】扫码完成:"+r);
} }
} }
else
{
string result = CodeLibrary.ZXingCodeHelper.DecodeQRCode(bitmap);
if (!String.IsNullOrEmpty(result))
{
return new List<string>() { result };
}
}
} }
} }
} }
...@@ -218,6 +231,37 @@ namespace OnlineStore.DeviceLibrary ...@@ -218,6 +231,37 @@ namespace OnlineStore.DeviceLibrary
return ""; return "";
} }
} }
public static string GetBarcode(string codeStr)
{
if (!string.IsNullOrEmpty(codeStr))
{
string[] codeInfos = codeStr.Replace("\r", "").Split('\n');
string ri = "";
string qty = "";
string youxiao = "";
foreach (string codeInfo in codeInfos)
{
if (codeInfo.StartsWith("物料编码:"))
{
ri = codeInfo.Substring(5);
}
else if (codeInfo.StartsWith("入库数量:"))
{
qty = codeInfo.Substring(5);
}
else if (codeInfo.StartsWith("有效期限:"))
{
youxiao = codeInfo.Substring(5);
}
}
if (!string.IsNullOrEmpty(ri))
{
string pn = ri.Split(' ')[0];
return pn + ";" + qty + ";" + ri + ";" + youxiao;
}
}
return "";
}
} }
} }
...@@ -230,28 +230,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -230,28 +230,7 @@ namespace OnlineStore.LoadCSVLibrary
} }
return newStr; return newStr;
} }
//private void ReadTest( )
//{
// Dictionary<string, string> dic = new Dictionary<string, string>();
// string path = Application.StartupPath + @"\Test.csv";
// dic.Add("AxisPosition", "中轴位置");
// dic.Add("ModbusHighPosition", "电钢高位");
// dic.Add("ModbusLowPosition", "电钢低位");
// Dictionary<string, KTKStorePostion> ddd = LoadCVSLibrary.CSVReaderHelper<KTKStorePostion>.ReadCVS(path, dic, typeof(KTKStorePostion));
// if (ddd != null)
// {
// MessageBox.Show("读取成功!");
// }
// else
// {
// MessageBox.Show("读取失败,请检查数据格式!");
// }
//}
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!