Commit be188147 LN

最新代码提交

1 个父辈 f427b7b6
此文件类型无法预览
...@@ -126,7 +126,7 @@ namespace ACServoDriveTest ...@@ -126,7 +126,7 @@ namespace ACServoDriveTest
{ {
//bean.closePort(); //bean.closePort();
ACServerManager.ServoOff(GetPortName(), GetSlaveAddr()); ACServerManager.ServoOff(GetPortName(), GetSlaveAddr());
ACServerManager.ColsePort(GetPortName() ); // ACServerManager.ColsePort(GetPortName() );
formStatus(false); formStatus(false);
} }
private void Form1_Load(object sender, EventArgs e) private void Form1_Load(object sender, EventArgs e)
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.ACSingleStore</RootNamespace> <RootNamespace>OnlineStore.ACSingleStore</RootNamespace>
<AssemblyName>ZHACSingleStore</AssemblyName> <AssemblyName>ZHACSingleStore</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
...@@ -92,6 +92,12 @@ ...@@ -92,6 +92,12 @@
<DependentUpon>FrmStoreBox.cs</DependentUpon> <DependentUpon>FrmStoreBox.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="ManagerUtil.cs" /> <Compile Include="ManagerUtil.cs" />
<Compile Include="positionTool\FrmPositionTool.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="positionTool\FrmPositionTool.Designer.cs">
<DependentUpon>FrmPositionTool.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FrmAxisDebug.resx"> <EmbeddedResource Include="FrmAxisDebug.resx">
...@@ -109,6 +115,9 @@ ...@@ -109,6 +115,9 @@
<EmbeddedResource Include="FrmStoreBox.resx"> <EmbeddedResource Include="FrmStoreBox.resx">
<DependentUpon>FrmStoreBox.cs</DependentUpon> <DependentUpon>FrmStoreBox.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="positionTool\FrmPositionTool.resx">
<DependentUpon>FrmPositionTool.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
...@@ -128,79 +137,6 @@ ...@@ -128,79 +137,6 @@
<DependentUpon>Settings.settings</DependentUpon> <DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput> <DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile> </Compile>
<None Include="Skins\back\DeepCyan.ssk" />
<None Include="Skins\back\DeepGreen.ssk" />
<None Include="Skins\back\DeepOrange.ssk" />
<None Include="Skins\Calmness.ssk" />
<None Include="Skins\CalmnessColor1.ssk" />
<None Include="Skins\CalmnessColor2.ssk" />
<None Include="Skins\DiamondBlue.ssk" />
<None Include="Skins\DiamondGreen.ssk" />
<None Include="Skins\DiamondOlive.ssk" />
<None Include="Skins\DiamondPurple.ssk" />
<None Include="Skins\DiamondRed.ssk" />
<None Include="Skins\Eighteen.ssk" />
<None Include="Skins\EighteenColor1.ssk" />
<None Include="Skins\EighteenColor2.ssk" />
<None Include="Skins\Emerald.ssk" />
<None Include="Skins\EmeraldColor1.ssk" />
<None Include="Skins\EmeraldColor2.ssk" />
<None Include="Skins\EmeraldColor3.ssk" />
<None Include="Skins\GlassBrown.ssk" />
<None Include="Skins\GlassGreen.ssk" />
<None Include="Skins\GlassOrange.ssk" />
<None Include="Skins\Longhorn.ssk" />
<None Include="Skins\MacOS.ssk" />
<None Include="Skins\Midsummer.ssk" />
<None Include="Skins\MidsummerColor1.ssk" />
<None Include="Skins\MidsummerColor2.ssk" />
<None Include="Skins\MidsummerColor3.ssk" />
<None Include="Skins\mp10.ssk" />
<None Include="Skins\mp10green.ssk" />
<None Include="Skins\mp10maroon.ssk" />
<None Include="Skins\mp10mulberry.ssk" />
<None Include="Skins\mp10pink.ssk" />
<None Include="Skins\mp10purple.ssk" />
<None Include="Skins\MSN.ssk" />
<None Include="Skins\office2007.ssk" />
<None Include="Skins\OneBlue.ssk" />
<None Include="Skins\OneCyan.ssk" />
<None Include="Skins\OneGreen.ssk" />
<None Include="Skins\OneOrange.ssk" />
<None Include="Skins\Page.ssk" />
<None Include="Skins\PageColor1.ssk" />
<None Include="Skins\PageColor2.ssk" />
<None Include="Skins\RealOne.ssk" />
<None Include="Skins\Silver.ssk" />
<None Include="Skins\SilverColor1.ssk" />
<None Include="Skins\SilverColor2.ssk" />
<None Include="Skins\SportsBlack.ssk" />
<None Include="Skins\SportsBlue.ssk" />
<None Include="Skins\SportsCyan.ssk" />
<None Include="Skins\SportsGreen.ssk" />
<None Include="Skins\SportsOrange.ssk" />
<None Include="Skins\SteelBlack.ssk" />
<None Include="Skins\SteelBlue.ssk" />
<None Include="Skins\vista1.ssk" />
<None Include="Skins\vista1_green.ssk" />
<None Include="Skins\Vista2_color1.ssk" />
<None Include="Skins\Vista2_color2.ssk" />
<None Include="Skins\Vista2_color3.ssk" />
<None Include="Skins\Vista2_color4.ssk" />
<None Include="Skins\Vista2_color5.ssk" />
<None Include="Skins\Vista2_color6.ssk" />
<None Include="Skins\Vista2_color7.ssk" />
<None Include="Skins\Warm.ssk" />
<None Include="Skins\WarmColor1.ssk" />
<None Include="Skins\WarmColor2.ssk" />
<None Include="Skins\WarmColor3.ssk" />
<None Include="Skins\Wave.ssk" />
<None Include="Skins\WaveColor1.ssk" />
<None Include="Skins\WaveColor2.ssk" />
<None Include="Skins\XPBlue.ssk" />
<None Include="Skins\XPGreen.ssk" />
<None Include="Skins\XPOrange.ssk" />
<None Include="Skins\XPSilver.ssk" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config"> <None Include="App.config">
......
<?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="zhac1" /> <add key="Store_CID" value="zhac1"/>
<!--end one store config--> <!--end one store config-->
<!--摄像机名称列表配置,用#分割--> <!--摄像机名称列表配置,用#分割-->
<add key="CameraName" value="GigE:MV-CE100-30GC (00C69898484)" /> <add key="CameraName" value="GigE:MV-CE100-30GC (00C69898484)"/>
<!--二维码类型列表配置,用#分割,一维码=Barcode。--> <!--二维码类型列表配置,用#分割,一维码=Barcode。-->
<add key="CodeType" value="Barcode" /> <add key="CodeType" value="Barcode"/>
<!--<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 ="600"/> <add key="OutStoreWaitSeconds" value="600"/>
<!--压紧轴对应4mm的脉冲--> <!--压紧轴对应4mm的脉冲-->
<add key="ComAxisChangeValue" value="2400" /> <add key="ComAxisChangeValue" value="2400"/>
<!--伺服波特率-->
<add key="ACBaudRate" value="115200"/>
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/ZHACStore1.log" /> <file value="logs/ZHACStore1.log"/>
<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 不支持库的配置文件。 -->
...@@ -63,14 +65,14 @@ ...@@ -63,14 +65,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>
...@@ -80,11 +82,11 @@ ...@@ -80,11 +82,11 @@
<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>
......
...@@ -23,17 +23,19 @@ namespace OnlineStore.ACSingleStore ...@@ -23,17 +23,19 @@ namespace OnlineStore.ACSingleStore
private ConfigMoveAxis updown = null; private ConfigMoveAxis updown = null;
//private ConfigMoveAxis compress = null; //private ConfigMoveAxis compress = null;
private ConfigMoveAxis inout = null; private ConfigMoveAxis inout = null;
private int compress_Slv = 0; private ConfigMoveAxis comp = null;
//private int compress_Slv = 0;
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public FrmAxisDebug(AC_SA_BoxBean boxBean) public FrmAxisDebug(AC_SA_BoxBean boxBean)
{ {
middle = boxBean.Config.Middle_Axis; middle = boxBean.Config.Middle_Axis;
updown = boxBean.Config.UpDown_Axis; updown = boxBean.Config.UpDown_Axis;
compress_Slv = boxBean.Config.CompressAxis_Slv; //compress_Slv = boxBean.Config.CompressAxis_Slv;
comp = boxBean.Config.Comp_Axis;
inout = boxBean.Config.InOut_Axis; inout = boxBean.Config.InOut_Axis;
InitializeComponent(); InitializeComponent();
txtComSpeed.Text = boxBean.Config.CompressAxis_EndSpeed.ToString();
this.Text = boxBean.StoreName + "_轴点动调试"; this.Text = boxBean.StoreName + "_轴点动调试";
} }
...@@ -48,7 +50,7 @@ namespace OnlineStore.ACSingleStore ...@@ -48,7 +50,7 @@ namespace OnlineStore.ACSingleStore
txtMiddleSpeed.Text = (middle.TargetSpeed / 5).ToString(); txtMiddleSpeed.Text = (middle.TargetSpeed / 5).ToString();
txtInOutSpeed.Text = (inout.TargetSpeed / 5).ToString(); txtInOutSpeed.Text = (inout.TargetSpeed / 5).ToString();
txtUpDownSpeed.Text = (updown.TargetSpeed / 5).ToString(); txtUpDownSpeed.Text = (updown.TargetSpeed / 5).ToString();
txtComSpeed.Text = (StoreManager.Config.CompressAxis_EndSpeed/5).ToString(); txtComSpeed.Text = (comp.TargetSpeed/5).ToString();
timer1.Start(); timer1.Start();
} }
/// <summary> /// <summary>
...@@ -246,6 +248,8 @@ namespace OnlineStore.ACSingleStore ...@@ -246,6 +248,8 @@ namespace OnlineStore.ACSingleStore
} }
private void btnComMove_MouseDown(object sender, MouseEventArgs e) private void btnComMove_MouseDown(object sender, MouseEventArgs e)
{ {
if (btnComMove.BackColor.Equals(System.Drawing.SystemColors.Control))
{
int speed = FormUtil.GetIntValue(txtComSpeed); int speed = FormUtil.GetIntValue(txtComSpeed);
if (speed <= 0) if (speed <= 0)
{ {
...@@ -253,10 +257,8 @@ namespace OnlineStore.ACSingleStore ...@@ -253,10 +257,8 @@ namespace OnlineStore.ACSingleStore
return; return;
} }
this.btnComMove.BackColor = Color.Green; this.btnComMove.BackColor = Color.Green;
AxisMove(comp, speed);
ShuoKeControls.SetSpeed(compress_Slv, ShuoKeCMD.SetEndSpeed, speed); }
ShuoKeControls.SetSpeed(compress_Slv, ShuoKeCMD.SetMaxSpeed, speed);
ShuoKeControls.VolMove(compress_Slv, speed);
} }
private void btnComMove_MouseUp(object sender, MouseEventArgs e) private void btnComMove_MouseUp(object sender, MouseEventArgs e)
...@@ -264,10 +266,8 @@ namespace OnlineStore.ACSingleStore ...@@ -264,10 +266,8 @@ namespace OnlineStore.ACSingleStore
if (this.btnComMove.BackColor == Color.Green) if (this.btnComMove.BackColor == Color.Green)
{ {
btnComMove.BackColor = System.Drawing.SystemColors.Control; btnComMove.BackColor = System.Drawing.SystemColors.Control;
ShuoKeControls.SuddownStop(compress_Slv); ACServerManager.SuddenStop(comp.DeviceName, comp.GetAxisValue());
// ShuoKeControls.GetABSPosition(compress_Slv); UpdateCompPosition();
txtComPosition.Text = ShuoKeControls.GetABSPosition(compress_Slv).ToString();
} }
} }
private void btnComMovej_MouseDown(object sender, MouseEventArgs e) private void btnComMovej_MouseDown(object sender, MouseEventArgs e)
...@@ -279,9 +279,7 @@ namespace OnlineStore.ACSingleStore ...@@ -279,9 +279,7 @@ namespace OnlineStore.ACSingleStore
return; return;
} }
this.btnComMovej.BackColor = Color.Green; this.btnComMovej.BackColor = Color.Green;
ShuoKeControls.SetSpeed(compress_Slv, ShuoKeCMD.SetEndSpeed, speed); AxisMove(comp, -speed);
ShuoKeControls.SetSpeed(compress_Slv, ShuoKeCMD.SetMaxSpeed, speed);
ShuoKeControls.VolMove(compress_Slv,-speed);
} }
private void btnComMovej_MouseUp(object sender, MouseEventArgs e) private void btnComMovej_MouseUp(object sender, MouseEventArgs e)
...@@ -289,9 +287,8 @@ namespace OnlineStore.ACSingleStore ...@@ -289,9 +287,8 @@ namespace OnlineStore.ACSingleStore
if (btnComMovej.BackColor.Equals(Color.Green)) if (btnComMovej.BackColor.Equals(Color.Green))
{ {
btnComMovej.BackColor = System.Drawing.SystemColors.Control; btnComMovej.BackColor = System.Drawing.SystemColors.Control;
ShuoKeControls.SuddownStop(compress_Slv); ACServerManager.SuddenStop(comp.DeviceName,comp.GetAxisValue());
// ShuoKeControls.GetABSPosition(compress_Slv); UpdateCompPosition();
txtComPosition.Text = ShuoKeControls.GetABSPosition(compress_Slv).ToString();
} }
} }
...@@ -303,7 +300,6 @@ namespace OnlineStore.ACSingleStore ...@@ -303,7 +300,6 @@ namespace OnlineStore.ACSingleStore
private void FrmAxisDebug_Shown(object sender, EventArgs e) private void FrmAxisDebug_Shown(object sender, EventArgs e)
{ {
SetSkin(this);
} }
private void timer1_Tick(object sender, EventArgs e) private void timer1_Tick(object sender, EventArgs e)
...@@ -313,22 +309,18 @@ namespace OnlineStore.ACSingleStore ...@@ -313,22 +309,18 @@ namespace OnlineStore.ACSingleStore
UpdateMiddlePosition(); UpdateMiddlePosition();
UpdateInOutPosition(); UpdateInOutPosition();
UpdateUpdownPosition(); UpdateUpdownPosition();
UpdateCompPosition();
txtComPosition.Text = ShuoKeControls.GetABSPosition(compress_Slv).ToString(); // txtComPosition.Text = ShuoKeControls.GetLastPosition(compress_Slv).ToString();
}
//ShuoKeInfo info = ShuoKeControls.GetLastPosition(compress_Slv); }
//if (info != null) private void UpdateCompPosition()
//{ {
// txtComPosition.Text = info.LastPosition.ToString(); int compPosition = ACServerManager.GetTargetPosition(comp.DeviceName, comp.GetAxisValue());
// TimeSpan span = DateTime.Now - info.UpdateTime; if (!txtComPosition.Text.Equals(compPosition.ToString()))
// if (span.TotalSeconds > 1.5) {
// { txtComPosition.Text = compPosition.ToString();
// ShuoKeControls.GetABSPosition(compress_Slv);
// }
//}
} }
} }
private void UpdateUpdownPosition() private void UpdateUpdownPosition()
{ {
int updownPosition = ACServerManager.GetTargetPosition(updown.DeviceName, updown.GetAxisValue()); int updownPosition = ACServerManager.GetTargetPosition(updown.DeviceName, updown.GetAxisValue());
...@@ -355,5 +347,35 @@ namespace OnlineStore.ACSingleStore ...@@ -355,5 +347,35 @@ namespace OnlineStore.ACSingleStore
txtInOutPosition.Text = inoutPosition.ToString(); txtInOutPosition.Text = inoutPosition.ToString();
} }
} }
private void trackBar1_ValueChanged(object sender, EventArgs e)
{
int value = trackBar1.Value;
lblSpeed.Text = "点动速度=" + (value / 10f) + "倍目标速度";
txtMiddleSpeed.Text = (middle.TargetSpeed * value / 10).ToString();
txtInOutSpeed.Text = (inout.TargetSpeed * value / 10).ToString();
txtUpDownSpeed.Text = (updown.TargetSpeed * value / 10).ToString();
txtComSpeed.Text = (comp.TargetSpeed * value / 10).ToString();
}
private void btnMCopy_Click(object sender, EventArgs e)
{
Clipboard.SetDataObject(txtMiddlePosition.Text, true);
}
private void btnUCopy_Click(object sender, EventArgs e)
{
Clipboard.SetDataObject(txtUpdownPosition.Text, true);
}
private void btnICopy_Click(object sender, EventArgs e)
{
Clipboard.SetDataObject(txtInOutPosition.Text, true);
}
private void btnCCopy_Click(object sender, EventArgs e)
{
Clipboard.SetDataObject(txtComPosition.Text, true);
}
} }
} }
...@@ -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())));
......
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file \ No newline at end of file
...@@ -87,3 +87,53 @@ bug修改:压紧轴点动时实时坐标更新。 ...@@ -87,3 +87,53 @@ bug修改:压紧轴点动时实时坐标更新。
增加压紧轴复位的配置。 增加压紧轴复位的配置。
StoreConfig.csv增加: StoreConfig.csv增加:
PRO,出入库多少次自动复位压紧轴,Box_ResetCCount,3,,,,,,, PRO,出入库多少次自动复位压紧轴,Box_ResetCCount,3,,,,,,,
20191210修改:
压紧轴改为伺服控制:
1.以前的三个轴波特率为9600,压紧轴的波特率需要一致.
2.所有压紧轴相关的位置都要重新配置,压紧轴回原点是向上的,位置都是正整数。
配置修改:
StoreConfig.csv删除原来的步进电机配置:
PRO,硕科步进电机(压紧轴)控制端口号,CompressAxis_PortName,COM3,,,,,,,
PRO,硕科步进电机(压紧轴)控制波特率,CompressAxis_PortBaudrate,9600,,,,,,,
PRO,硕科步进电机(压紧轴)控制奇偶校验,CompressAxis_PortParity,0,,,,,,,
PRO,硕科步进电机(压紧轴)控制停止位,CompressAxis_StopBits,1,,,,,,,
PRO,硕科步进电机(压紧轴)控制初速度,CompressAxis_StartSpeed,5000,,,,,,,
PRO,硕科步进电机(压紧轴)控制最大速度,CompressAxis_MaxSpeed,8000,,,,,,,
PRO,硕科步进电机(压紧轴)控制末速度,CompressAxis_EndSpeed,6000,,,,,,,
PRO,硕科步进电机(压紧轴)控制加速度,CompressAxis_AddSpeed,3000,,,,,,,
PRO,硕科步进电机(压紧轴)控制减速度,CompressAxis_DelSpeed,3000,,,,,,,
PRO,硕科步进电机(压紧轴)控制归零速度(原点返回速度),CompressAxis_HomeSpeed,5000,,,,,,,
PRO,硕科步进电机轴地址(压紧轴),CompressAxis_Slv,1,,,,,,,
增加压紧轴配置:
,,,,,,,,, ,
AXIS,(轴四)压紧轴,Comp_Axis,4,COM1,0,,,,,
PRO,(轴四)压紧轴目标速度,CompAxis_TargetSpeed,100,,,,,,,
PRO,(轴四)压紧轴加速度,CompAxis_AddSpeed,300,,,,,,,
PRO,(轴四)压紧轴减速度,CompAxis_DelSpeed,300,,,,,,,
PRO,(轴四)压紧轴原点低速,CompAxis_HomeLowSpeed,20,,,,,,,
PRO,(轴四)压紧轴原点高速,CompAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴四)压紧轴原点加速度,CompAxis_HomeAddSpeed,200,,,,,,,
PRO,压紧轴(轴4)P1速度,CompAxis_P1_Speed,100,,,,,,,
PRO,压紧轴(轴4)P2速度,CompAxis_P2_Speed,100,,,,,,,
PRO,压紧轴(轴4)P3速度,CompAxis_P3_Speed,100,,,,,,,
,,,,,,,
20200301
增加升降轴调试功能
20200305
进出轴回待机点时,原点信号必须亮。
20200311
扫码更新为最新版本。
...@@ -79,5 +79,15 @@ namespace OnlineStore.Common ...@@ -79,5 +79,15 @@ namespace OnlineStore.Common
/// 压紧轴1mm对应的脉冲 /// 压紧轴1mm对应的脉冲
/// </summary> /// </summary>
public static string ComAxisChangeValue = "ComAxisChangeValue"; public static string ComAxisChangeValue = "ComAxisChangeValue";
public static string ACBaudRate = "ACBaudRate";
public static string Tool_P3_Offset = "Tool_P3_Offset";
public static string Tool_P4_Offset = "Tool_P4_Offset";
public static string Tool_P5_Offset = "Tool_P5_Offset";
public static string Tool_P6_Offset = "Tool_P6_Offset";
public static string Tool_TargetSpeed = "Tool_TargetSpeed";
public static string Tool_TargetPosition = "Tool_TargetPosition";
} }
} }
...@@ -282,13 +282,13 @@ namespace OnlineStore.Common ...@@ -282,13 +282,13 @@ namespace OnlineStore.Common
/// <param name="ReceiveData">接收数据</param> /// <param name="ReceiveData">接收数据</param>
/// <param name="Overtime">超时时间</param> /// <param name="Overtime">超时时间</param>
/// <returns></returns> /// <returns></returns>
public int SendCommand(byte[] SendData, ref byte[] ReceiveData, int Overtime,out bool isOk) public int SendCommand(byte[] SendData, ref byte[] ReceiveData, int Overtime, out bool isOk)
{ {
isOk = false; isOk = false;
if (_serialPort.IsOpen) if (_serialPort.IsOpen)
{ {
//lock (lockObj) //lock (lockObj)
if(Monitor.TryEnter(lockObj,10)) if (Monitor.TryEnter(lockObj, Overtime + 50))
{ {
//Monitor.Enter(lockObj); //Monitor.Enter(lockObj);
try try
...@@ -339,7 +339,7 @@ namespace OnlineStore.Common ...@@ -339,7 +339,7 @@ namespace OnlineStore.Common
return -1; return -1;
} }
private byte PreSlvAddr = 0;
/// <summary> /// <summary>
/// 发送命令 /// 发送命令
/// </summary> /// </summary>
...@@ -352,17 +352,28 @@ namespace OnlineStore.Common ...@@ -352,17 +352,28 @@ namespace OnlineStore.Common
{ {
if (_serialPort == null) if (_serialPort == null)
{ {
LogUtil.error(PortName+" 发送数据"+ByteToString(SendData)+ "失败,_serialPort=null"); LogUtil.error(PortName + " 发送数据" + ByteToString(SendData) + "失败,_serialPort=null");
return -1; return -1;
} }
if (_serialPort.IsOpen) if (_serialPort.IsOpen)
{ {
if (Monitor.TryEnter(lockObj, 1)) if (Monitor.TryEnter(lockObj, Overtime + 80))
{ {
//Monitor.Enter(lockObj); //Monitor.Enter(lockObj);
try try
{ {
//判断是否需要休眠
if (SendData != null && SendData.Length > 0)
{
if (!SendData[0].Equals(PreSlvAddr))
{
Thread.Sleep(50);
PreSlvAddr = SendData[0];
}
}
_serialPort.DiscardInBuffer(); //清空接收缓冲区 _serialPort.DiscardInBuffer(); //清空接收缓冲区
_serialPort.Write(SendData, 0, SendData.Length); _serialPort.Write(SendData, 0, SendData.Length);
int num = 0, ret = 0; int num = 0, ret = 0;
...@@ -395,7 +406,7 @@ namespace OnlineStore.Common ...@@ -395,7 +406,7 @@ namespace OnlineStore.Common
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(PortName + " 发送数据" + ByteToString(SendData) + " 出错:"+ex.ToString()); LogUtil.error(PortName + " 发送数据" + ByteToString(SendData) + " 出错:" + ex.ToString());
} }
finally finally
{ {
......
...@@ -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>
...@@ -67,8 +67,6 @@ ...@@ -67,8 +67,6 @@
<Compile Include="PanasonicServo\ACCMDManager.cs" /> <Compile Include="PanasonicServo\ACCMDManager.cs" />
<Compile Include="PanasonicServo\ACServerManager.cs" /> <Compile Include="PanasonicServo\ACServerManager.cs" />
<Compile Include="PanasonicServo\ACServerManager_Partial.cs" /> <Compile Include="PanasonicServo\ACServerManager_Partial.cs" />
<Compile Include="ShuoKe\MeteringSignalBean.cs" />
<Compile Include="ShuoKe\ShuoKeController.cs" />
<Compile Include="store\LineMoveP.cs" /> <Compile Include="store\LineMoveP.cs" />
<Compile Include="store\LineAlarm.cs"> <Compile Include="store\LineAlarm.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
......
...@@ -128,6 +128,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -128,6 +128,11 @@ namespace OnlineStore.DeviceLibrary
try try
{ {
isProcess = true; isProcess = true;
if (StoreManager.Store == null)
{
isProcess = false;
return;
}
bool IsNeedReadAI = StoreManager.Store.KNDIOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.HIGH); bool IsNeedReadAI = StoreManager.Store.KNDIOValue(IO_Type.TrayCheck_Door).Equals(IO_VALUE.HIGH);
IsNeedReadAI = (IsNeedReadAI || NeedReadAI); IsNeedReadAI = (IsNeedReadAI || NeedReadAI);
TimeSpan span = DateTime.Now - PreCheckTime; TimeSpan span = DateTime.Now - PreCheckTime;
......
...@@ -21,24 +21,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -21,24 +21,17 @@ namespace OnlineStore.DeviceLibrary
public static ushort DoStartAddress = 100; public static ushort DoStartAddress = 100;
public static ushort DefualtLength = 16; public static ushort DefualtLength = 16;
private static byte DefualtSlaveID = 255; private static byte DefualtSlaveID = 255;
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static Dictionary<string, MasterTcpClient> mastMap = new Dictionary<string, MasterTcpClient>(); private static Dictionary<string, MasterTcpClient> mastMap = new Dictionary<string, MasterTcpClient>();
public static Dictionary<string, List<KNDIO>> DIValueMap = new Dictionary<string, List<KNDIO>>(); private static Dictionary<string, List<KNDIO>> DIValueMap = new Dictionary<string, List<KNDIO>>();
public static Dictionary<string, List<KNDIO>> DOValueMap = new Dictionary<string, List<KNDIO>>(); private static Dictionary<string, List<KNDIO>> DOValueMap = new Dictionary<string, List<KNDIO>>();
private static object DIMapLock = ""; private static object DIMapLock = "";
private static object DOMapLock = ""; private static object DOMapLock = "";
public static System.Timers.Timer timer = null; private static System.Timers.Timer timer = null;
private static bool isWrite=false; private static bool isWrite=false;
public static void ConnectionIP(string ioIp, ushort port) private static void ConnectionIP(string ioIp, ushort port)
{ {
if (timer == null)
{
timer = new System.Timers.Timer();
timer.Interval = 300;
timer.AutoReset = true;
timer.Elapsed += timer_Elapsed;
timer.Enabled = true;
}
MasterTcpClient MBmaster = null; MasterTcpClient MBmaster = null;
if (mastMap.ContainsKey(ioIp)) if (mastMap.ContainsKey(ioIp))
{ {
...@@ -77,13 +70,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -77,13 +70,19 @@ namespace OnlineStore.DeviceLibrary
mastMap.Add(ioIp, MBmaster); mastMap.Add(ioIp, MBmaster);
Thread.Sleep(10); Thread.Sleep(10);
if (MBmaster.connected)
{
LogUtil.info("连接IO模块[" + ioIp + "]成功"); LogUtil.info("连接IO模块[" + ioIp + "]成功");
//读取所有的DO MBmaster.ReadCoils(1, DoStartAddress, DefualtLength, DefualtSlaveID);
ReadMultipleDO(ioIp, DefualtSlaveID, DoStartAddress, DefualtLength); }
else
{
LogUtil.info("连接IO模块[" + ioIp + "]失败,等待重连");
}
} }
catch (Exception error) catch (Exception error)
{ {
LogUtil.error(LOGGER,"连接IO模块[" + ioIp + "]出错:"+error.ToString()); LogUtil.error(LOGGER, "连接IO模块[" + ioIp + "]出错:" + error.ToString());
} }
} }
/// <summary> /// <summary>
...@@ -130,7 +129,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -130,7 +129,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(LOGGER, "出错啦:"+ex.ToString()); LogUtil.error(LOGGER, "出错啦:"+ex.StackTrace);
} }
Thread.Sleep(1); Thread.Sleep(1);
} }
...@@ -143,13 +142,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -143,13 +142,21 @@ namespace OnlineStore.DeviceLibrary
{ {
ConnectionIP(ip, port); ConnectionIP(ip, port);
} }
} if (timer == null)
public static void ConnectionKND(string ip)
{ {
//端口号暂时使用固定的502; timer = new System.Timers.Timer();
ushort port = 502; timer.Interval = 1000;
ConnectionIP(ip, port); timer.AutoReset = true;
timer.Elapsed += timer_Elapsed;
timer.Enabled = true;
} }
}
//public static void ConnectionKND(string ip)
//{
// //端口号暂时使用固定的502;
// ushort port = 502;
// ConnectionIP(ip, port);
//}
public static void ReadMultipleDI(string ioIp, byte slaveId, ushort StartAddress, ushort length) public static void ReadMultipleDI(string ioIp, byte slaveId, ushort StartAddress, ushort length)
{ {
isWrite = true; isWrite = true;
...@@ -188,8 +195,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -188,8 +195,14 @@ namespace OnlineStore.DeviceLibrary
isWrite = true; isWrite = true;
foreach (string key in mastMap.Keys) foreach (string key in mastMap.Keys)
{ {
byte[] data = new byte[] { 0,0}; try
{
byte[] data = new byte[] { 0, 0 };
WriteMultipleDO(key, DefualtSlaveID, DoStartAddress, DefualtLength, data); WriteMultipleDO(key, DefualtSlaveID, DoStartAddress, DefualtLength, data);
}catch (Exception ex)
{
LogUtil.error("CloseAllDO出错:" + ex.ToString());
}
} }
isWrite = false; isWrite = false;
} }
......
...@@ -11,8 +11,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -11,8 +11,16 @@ namespace OnlineStore.DeviceLibrary
/// 0132h 原点接近传感器输入 (HOME) 状态 ReadOnly 0: 输入 OFF 1: 输入 ON /// 0132h 原点接近传感器输入 (HOME) 状态 ReadOnly 0: 输入 OFF 1: 输入 ON
/// </summary> /// </summary>
public static string Home_Single = "0132"; public static string Home_Single = "0132";
// 0022h 负方向驱动禁止输入(NOT) ReadOnly 0: 输入 OFF、 1: 输入 ON
// 0023h 正方向驱动禁止输入(POT) ReadOnly 0: 输入 OFF、 1: 输入 ON /// <summary>
/// 0022h 负方向驱动禁止输入(NOT) ReadOnly 0: 输入 OFF、 1: 输入 ON
/// </summary>
public static string Limit_Negative_Single = "0022";
/// <summary>
/// 0023h 正方向驱动禁止输入(POT) ReadOnly 0: 输入 OFF、 1: 输入 ON
/// </summary>
public static string Limit_Positive_Single = "0023";
/// <summary> /// <summary>
///速度 4601 ///速度 4601
/// </summary> /// </summary>
...@@ -320,6 +328,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -320,6 +328,7 @@ namespace OnlineStore.DeviceLibrary
//sendData[4] = dataByte[1]; //sendData[4] = dataByte[1];
//sendData[5] = dataByte[0]; //sendData[5] = dataByte[0];
} }
sendData = buildCheckData(sendData, sendData.Length - 2); sendData = buildCheckData(sendData, sendData.Length - 2);
......
...@@ -32,8 +32,8 @@ DO,相机照明开,CameraLight_Power,110,192.168.200.11,0,相机照明开,Y11,DO-11,0, ...@@ -32,8 +32,8 @@ DO,相机照明开,CameraLight_Power,110,192.168.200.11,0,相机照明开,Y11,DO-11,0,
DO,允许放料信号,CanPutTray,114,192.168.200.11,0,允许放料信号,Y15,DO-15,0, DO,允许放料信号,CanPutTray,114,192.168.200.11,0,允许放料信号,Y15,DO-15,0,
DO,可取料信号,CanGetTray,115,192.168.200.11,0,可取料信号,Y16,DO-16,0, DO,可取料信号,CanGetTray,115,192.168.200.11,0,可取料信号,Y16,DO-16,0,
AXIS,(轴一)旋转轴,Middle_Axis,1,COM6,0,,,,, AXIS,(轴一)旋转轴,Middle_Axis,1,COM6,0,,,,,
AXIS,(轴二)升降轴轴,UpDown_Axis,1,COM5,0,,,,, AXIS,(轴二)升降轴轴,UpDown_Axis,2,COM6,0,,,,,
AXIS,(轴三)进出轴,InOut_Axis,1,COM4,0,,,,, AXIS,(轴三)进出轴,InOut_Axis,3,COM6,0,,,,,
,温湿度传感器地址,Temperate_ServerAddress,192.168.200.34,,,,,,, ,温湿度传感器地址,Temperate_ServerAddress,192.168.200.34,,,,,,,
,扫码枪IP,Scanner_Ip,192.168.200.33,,,,,,, ,扫码枪IP,Scanner_Ip,192.168.200.33,,,,,,,
,扫码枪端口号,Scanner_Port,51236,,,,,,, ,扫码枪端口号,Scanner_Port,51236,,,,,,,
...@@ -43,7 +43,7 @@ PRO,升降轴 进料口取料缓冲点 P7,UpDownAxis_DoorOBPosition_P7,415000,,,,,,, ...@@ -43,7 +43,7 @@ PRO,升降轴 进料口取料缓冲点 P7,UpDownAxis_DoorOBPosition_P7,415000,,,,,,,
PRO,升降轴 进料口出料缓冲点 P8,UpDownAxis_DoorIBPosition_P8,403000,,,,,,, PRO,升降轴 进料口出料缓冲点 P8,UpDownAxis_DoorIBPosition_P8,403000,,,,,,,
PRO,旋转轴(轴1)P1 待机原位点,MiddleAxis_P1_Position,268093,,,,,,, PRO,旋转轴(轴1)P1 待机原位点,MiddleAxis_P1_Position,268093,,,,,,,
PRO,进出轴(轴3)P1待机原位点,InOutAxis_P1_Position,1000,,,,,,, PRO,进出轴(轴3)P1待机原位点,InOutAxis_P1_Position,1000,,,,,,,
PRO,压紧轴(轴4)P1待机原位点,CompressAxis_P1_Position,-7500,,,,,,, PRO,压紧轴(轴4)P1待机原位点,CompressAxis_P1_Position,10000,,,,,,,
PRO,是否使用定位气缸,IsHasLocationCylinder,0,,,,,,, PRO,是否使用定位气缸,IsHasLocationCylinder,0,,,,,,,
PRO,是否有左右侧门,IsHasDoorLimit,1,,,,,,, PRO,是否有左右侧门,IsHasDoorLimit,1,,,,,,,
PRO,是否使用压紧轴(1=使用),IsHasCompress_Axis,1,,,,, ,, PRO,是否使用压紧轴(1=使用),IsHasCompress_Axis,1,,,,, ,,
...@@ -70,6 +70,7 @@ PRO,(轴三)进出轴减速度,InoutAxis_DelSpeed,300,,,,,,, ...@@ -70,6 +70,7 @@ PRO,(轴三)进出轴减速度,InoutAxis_DelSpeed,300,,,,,,,
PRO,(轴三)进出轴原点低速,InoutAxis_HomeLowSpeed,20,,,,,,, PRO,(轴三)进出轴原点低速,InoutAxis_HomeLowSpeed,20,,,,,,,
PRO,(轴三)进出轴原点高速,InoutAxis_HomeHighSpeed,60,,,,,,, PRO,(轴三)进出轴原点高速,InoutAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴三)进出轴原点加速度,InoutAxis_HomeAddSpeed,200,,,,,,, PRO,(轴三)进出轴原点加速度,InoutAxis_HomeAddSpeed,200,,,,,,,
PRO,升降轴(轴2)P1速度,UpDownAxis_P1_Speed,250,,,,,,, PRO,升降轴(轴2)P1速度,UpDownAxis_P1_Speed,250,,,,,,,
PRO,升降轴(轴2)P2速度,UpDownAxis_P2_Speed,250,,,,,,, PRO,升降轴(轴2)P2速度,UpDownAxis_P2_Speed,250,,,,,,,
PRO,升降轴(轴2)P3速度,UpDownAxis_P3_Speed,250,,,,,,, PRO,升降轴(轴2)P3速度,UpDownAxis_P3_Speed,250,,,,,,,
...@@ -106,18 +107,6 @@ PRO,每次吹气的时间(分钟),BlowAir_Time,10,,,,,,, ...@@ -106,18 +107,6 @@ PRO,每次吹气的时间(分钟),BlowAir_Time,10,,,,,,,
PRO,两次吹气间隔(分钟),BlowAir_Interval,10,,,,,,, PRO,两次吹气间隔(分钟),BlowAir_Interval,10,,,,,,,
PRO,温湿度端口号,Humiture_Port,COM1,,,,,,, PRO,温湿度端口号,Humiture_Port,COM1,,,,,,,
,,,,,,,,, , ,,,,,,,,, ,
PRO,硕科步进电机(压紧轴)控制端口号,CompressAxis_PortName,COM3,,,,,,,
PRO,硕科步进电机(压紧轴)控制波特率,CompressAxis_PortBaudrate,9600,,,,,,,
PRO,硕科步进电机(压紧轴)控制奇偶校验,CompressAxis_PortParity,0,,,,,,,
PRO,硕科步进电机(压紧轴)控制停止位,CompressAxis_StopBits,1,,,,,,,
PRO,硕科步进电机(压紧轴)控制初速度,CompressAxis_StartSpeed,5000,,,,,,,
PRO,硕科步进电机(压紧轴)控制最大速度,CompressAxis_MaxSpeed,8000,,,,,,,
PRO,硕科步进电机(压紧轴)控制末速度,CompressAxis_EndSpeed,6000,,,,,,,
PRO,硕科步进电机(压紧轴)控制加速度,CompressAxis_AddSpeed,3000,,,,,,,
PRO,硕科步进电机(压紧轴)控制减速度,CompressAxis_DelSpeed,3000,,,,,,,
PRO,硕科步进电机(压紧轴)控制归零速度(原点返回速度),CompressAxis_HomeSpeed,5000,,,,,,,
PRO,硕科步进电机轴地址(压紧轴),CompressAxis_Slv,1,,,,,,,
,,,,,,,,, ,
PRO,模拟量IO模块的IP地址,AIDevice_IP,192.168.200.12,,,,,,, PRO,模拟量IO模块的IP地址,AIDevice_IP,192.168.200.12,,,,,,,
PRO,模拟信号1默认高度,AIDI1_DefaultPosition,2920,,,,,,, PRO,模拟信号1默认高度,AIDI1_DefaultPosition,2920,,,,,,,
PRO,模拟信号2默认高度,AIDI2_DefaultPosition,2960,,,,,,, PRO,模拟信号2默认高度,AIDI2_DefaultPosition,2960,,,,,,,
...@@ -125,3 +114,15 @@ PRO,模拟信号3默认高度,AIDI3_DefaultPosition,2500,,,,,,, ...@@ -125,3 +114,15 @@ PRO,模拟信号3默认高度,AIDI3_DefaultPosition,2500,,,,,,,
,,,,,,,,, , ,,,,,,,,, ,
PRO,模拟信号1的地址,AIDI1_Addr,7,,,,,,, PRO,模拟信号1的地址,AIDI1_Addr,7,,,,,,,
PRO,模拟信号2的地址,AIDI2_Addr,8,,,,,,, PRO,模拟信号2的地址,AIDI2_Addr,8,,,,,,,
,,,,,,,,, ,
AXIS,(轴四)压紧轴,Comp_Axis,4,COM6,0,,,,,
PRO,(轴四)压紧轴目标速度,CompAxis_TargetSpeed,100,,,,,,,
PRO,(轴四)压紧轴加速度,CompAxis_AddSpeed,300,,,,,,,
PRO,(轴四)压紧轴减速度,CompAxis_DelSpeed,300,,,,,,,
PRO,(轴四)压紧轴原点低速,CompAxis_HomeLowSpeed,20,,,,,,,
PRO,(轴四)压紧轴原点高速,CompAxis_HomeHighSpeed,60,,,,,,,
PRO,(轴四)压紧轴原点加速度,CompAxis_HomeAddSpeed,200,,,,,,,
PRO,压紧轴(轴4)P1速度,CompAxis_P1_Speed,100,,,,,,,
PRO,压紧轴(轴4)P2速度,CompAxis_P2_Speed,100,,,,,,,
PRO,压紧轴(轴4)P3速度,CompAxis_P3_Speed,100,,,,,,,
,,,,,,,
...@@ -29,24 +29,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -29,24 +29,6 @@ namespace OnlineStore.DeviceLibrary
public StoreManager() public StoreManager()
{ {
} }
public static bool OpenShuoKe(AC_SA_BoxBean box)
{
//打开硕科步进驱动器端口
Parity parity = (Parity)box.Config.CompressAxis_PortParity;
StopBits bit = (StopBits)box.Config.CompressAxis_StopBits;
bool result = ShuoKeControls.InitPort(box.Config.CompressAxis_PortName, box.Config.CompressAxis_PortBaudrate,
box.Config.CompressAxis_PortParity, 8, bit);
if (result)
{
LogUtil.info(box.StoreName + "打开硕科步进控制器【" + box.Config.CompressAxis_PortName + "】成功");
return true;
}
else
{
LogUtil.error(box.StoreName + "打开硕科步进控制器【" + box.Config.CompressAxis_PortName + "】失败,启动失败!");
return false;
}
}
public static void CheckEnum(Type type) public static void CheckEnum(Type type)
{ {
if (type.IsEnum) if (type.IsEnum)
......
...@@ -4,6 +4,7 @@ using OnlineStore.Common; ...@@ -4,6 +4,7 @@ using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.ExceptionServices; using System.Runtime.ExceptionServices;
...@@ -18,7 +19,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -18,7 +19,7 @@ namespace OnlineStore.DeviceLibrary
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>();
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>();
private static char spiltChar = '#'; private static char spiltChar = '#';
...@@ -43,22 +44,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -43,22 +44,15 @@ namespace OnlineStore.DeviceLibrary
string[] codeArray = codeStr.Split(spiltChar); string[] codeArray = codeStr.Split(spiltChar);
foreach (string str in codeArray) foreach (string str in codeArray)
{ {
if (str.Trim().Equals(""))
{
continue;
}
LogUtil.info("加载到配置二维码类型:" + str.Trim()); LogUtil.info("加载到配置二维码类型:" + str.Trim());
codeTypeList.Add(str.Trim()); codeTypeList.Add(str.Trim());
} }
string[] names = CodeLibrary.HIKCamera.Instance.CameraName; LoadCamera(false);
hikNameList.AddRange(names);
foreach(string str in names)
{
LogUtil.info("加载到HIK相机:" + str.Trim());
}
names = CodeLibrary.BaslerCamera.Instance.CameraName;
balserNameList.AddRange(names);
foreach (string str in names)
{
LogUtil.info("加载到Balser相机:" + str.Trim());
}
CodeLibrary.HDCodeLearnHelper.LoadConfig(nameStr, codeStr); CodeLibrary.HDCodeLearnHelper.LoadConfig(nameStr, codeStr);
} }
...@@ -67,70 +61,70 @@ namespace OnlineStore.DeviceLibrary ...@@ -67,70 +61,70 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error("解析摄像机配置出错:" + ex.ToString()); LogUtil.error("解析摄像机配置出错:" + ex.ToString());
} }
} }
private static void LoadCamera(bool isReLoad)
public static void CloseCamera()
{ {
BaslerCamera.Instance.Close(); if (isReLoad || Camera._cam == null)
HIKCamera.Instance.Close();
}
public static Bitmap GetCamerImage(string cameraName)
{ {
Bitmap bitm = null;
try try
{ {
if (balserNameList.Contains(cameraName)) if (Camera._cam != null)
{
bool result = BaslerCamera.Instance.IsOpen;
if (!result)
{ {
result = BaslerCamera.Instance.Open(cameraName); Camera._cam.CloseAll();
LogUtil.info("打开相机:" + cameraName + "(" + result + ")");
} }
if (result) Camera.Type = CameraType.HIK;
{ Camera._cam.Load();
BaslerCamera.Instance.GrabOne();
bitm = BaslerCamera.Instance.Image;
//BaslerCamera.Instance.Close();
} }
else catch (Exception ex)
{ {
LogUtil.error("相机【" + cameraName + "】打开失败:" + BaslerCamera.Instance.ErrInfo); LogUtil.error("加载HIK相机出错:" + ex.ToString());
} }
} }
else if (hikNameList.Contains(cameraName)) string[] names = Camera._cam.Name;
{
bool result = HIKCamera.Instance.IsOpen;
if (!result) if (names != null)
{ {
result= HIKCamera.Instance.Open(cameraName); foreach (string n in names)
LogUtil.info("打开相机:" + cameraName + "(" + result + ")");
}
if (result)
{ {
HIKCamera.Instance.GrabOne(); if (!hikNameList.Contains(n))
bitm = HIKCamera.Instance.Image;
//HIKCamera.Instance.Close();
}
else
{ {
LogUtil.error("相机【" + cameraName + "】打开失败:" + HIKCamera.Instance.ErrInfo); hikNameList.Add(n);
} }
} }
else // hikNameList.AddRange(names);
foreach (string name in hikNameList)
{ {
LogUtil.info("未找到相机【" + cameraName + "】无法获取图片"); LogUtil.info("加载到HIK相机:" + name);
} }
} }
catch (Exception ex) }
public static void CloseCamera(string cameraName)
{ {
LogUtil.error("从相机【" + cameraName + "】获取图片出错:" + ex.ToString()); Camera._cam.Close(cameraName);
} }
return bitm; public static void CloseAllCamera()
{
//BaslerCamera.Instance.Close();
//HIKCamera.Instance.Close();
Camera._cam.CloseAll();
} }
//public static Bitmap GetCamerImage(string cameraName)
//{
// Bitmap bitm = null;
// try
// {
// bitm = Camera._cam.GrabOneImage(cameraName);
// }
// catch (Exception ex)
// {
// LogUtil.error(" 【" + cameraName + "】获取图片出错:" + ex.ToString());
// }
// return bitm;
//}
[HandleProcessCorruptedStateExceptions] [HandleProcessCorruptedStateExceptions]
public static List<string> CameraScan( ) public static List<string> CameraScan()
{ {
List<string> codeList = new List<string>(); List<string> codeList = new List<string>();
List<CodeInfo> allCodeList = new List<CodeInfo>(); List<CodeInfo> allCodeList = new List<CodeInfo>();
...@@ -139,19 +133,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -139,19 +133,21 @@ namespace OnlineStore.DeviceLibrary
{ {
foreach (string cameraName in cameraNameList) foreach (string cameraName in cameraNameList)
{ {
using (Bitmap bitmap = GetCamerImage(cameraName)) HalconDotNet.HObject ho_Image = null;
try
{ {
if (bitmap == null) ho_Image = Camera._cam.CaptureOnImage(cameraName);
if (ho_Image == null)
{ {
LogUtil.error(" 摄像机【" + cameraName + "】获取图片失败,关闭相机"); LogUtil.error(" 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
CloseCamera(); CloseCamera(cameraName);
continue; continue;
} }
//Bitmap bit = new Bitmap(bitmap);
LogUtil.debug(" 摄像机【" + cameraName + "】获取图片完成"); //LogUtil.debug(" 摄像机【" + cameraName + "】获取图片完成");
System.Threading.Thread.Sleep(1); //System.Threading.Thread.Sleep(1);
HObject ho_Image = HDCodeHelper.Bitmap2HObjectBpp24(bitmap); //HObject ho_Image = HDCodeHelper.Bitmap2HObjectBpp24(bit);
LogUtil.debug(" 摄像机【" + cameraName + "】转换图片完成,开始扫码"); LogUtil.info(" 【" + cameraName + "】转换图片完成,开始扫码");
List<CodeInfo> cc = new List<CodeInfo>(); List<CodeInfo> cc = new List<CodeInfo>();
foreach (string codeType in codeTypeList) foreach (string codeType in codeTypeList)
{ {
...@@ -164,22 +160,39 @@ namespace OnlineStore.DeviceLibrary ...@@ -164,22 +160,39 @@ namespace OnlineStore.DeviceLibrary
{ {
cc = HDCodeHelper.DecodeCode(ho_Image, 1, GetCodeParamFilePath(codeType), codeType); cc = HDCodeHelper.DecodeCode(ho_Image, 1, GetCodeParamFilePath(codeType), codeType);
} }
//LogUtil.info(" 摄像机【" + cameraName + "】【"+ codeType + "】扫码完成"); LogUtil.info(" 【" + cameraName + "】【"+ codeType + "】扫码完成");
} }
allCodeList.AddRange(cc); allCodeList.AddRange(cc);
} }
catch (AccessViolationException e)
{
LogUtil.error(" 扫码出现AccessViolationException异常,关闭相机【" + cameraName + "】:" + e.ToString());
Camera._cam.Close(cameraName);
// GC.Collect();
}
catch (Exception ex)
{
LogUtil.error(" 扫码出错:" + ex.ToString());
}
finally
{
if (ho_Image != null)
{
ho_Image.Dispose();
}
}
} }
} }
catch (AccessViolationException e) catch (AccessViolationException e)
{ {
LogUtil.error("扫码出现AccessViolationException异常:" + e.ToString()); LogUtil.error("扫码出现AccessViolationException异常:" + e.ToString());
GC.Collect(); // GC.Collect();
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("扫码出错:" + ex.ToString()); LogUtil.error("扫码出错:" + ex.ToString());
} }
foreach(CodeInfo info in allCodeList) foreach (CodeInfo info in allCodeList)
{ {
codeList.Add(info.CodeStr); codeList.Add(info.CodeStr);
} }
...@@ -204,3 +217,4 @@ namespace OnlineStore.DeviceLibrary ...@@ -204,3 +217,4 @@ namespace OnlineStore.DeviceLibrary
} }
} }
...@@ -254,7 +254,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -254,7 +254,7 @@ namespace OnlineStore.DeviceLibrary
//如果是进出轴,并且光栅被遮挡,直接返回false //如果是进出轴,并且光栅被遮挡,直接返回false
if (NeedCheckSafetyLight.Equals(2)) if (NeedCheckSafetyLight.Equals(2))
{ {
if (StoreMove.MoveStep.Equals(StoreMoveStep.SO_10_DeviceToDoor) || if (StoreMove.MoveStep.Equals(StoreMoveStep.SO_13_DeviceToDoor) ||
StoreMove.MoveStep.Equals(StoreMoveStep.SI_05_DeviceToDoor)) StoreMove.MoveStep.Equals(StoreMoveStep.SI_05_DeviceToDoor))
{ {
return false; return false;
......
...@@ -259,36 +259,39 @@ namespace OnlineStore.DeviceLibrary ...@@ -259,36 +259,39 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 料仓出库,定位气缸退回(有压紧轴的不需要此步骤),,定位气缸退回(Y104-1/PCI5O1-84) (Y104-2/PCI5O1-91) (Y104-2/PCI5O1-96) 退回到位 /// 料仓出库,定位气缸退回(有压紧轴的不需要此步骤),,定位气缸退回(Y104-1/PCI5O1-84) (Y104-2/PCI5O1-91) (Y104-2/PCI5O1-96) 退回到位
/// </summary> /// </summary>
SO_09_LocationCylinder_Down = 109, SO_09_LocationDown = 109,
/// <summary> /// <summary>
/// 等待门口无料盘 /// 等待门口无料盘
/// </summary> /// </summary>
SO_091_WaitNoTray=115, SO_11_WaitNoTray,
/// <summary>
/// 等待门口无料盘
/// </summary>
SO_12_OpenDoor,
/// <summary> /// <summary>
/// 料仓出库,,叉子进出料口,,轴3( 叉子) 至P2( 进料口取料点) /// 料仓出库,,叉子进出料口,,轴3( 叉子) 至P2( 进料口取料点)
/// /// </summary> /// /// </summary>
SO_10_DeviceToDoor = 110, SO_13_DeviceToDoor,
/// <summary> /// <summary>
/// 料仓出库,,把物品放下,,轴2( 上下) 至P8( 进料口出料缓冲点)轴4( 压紧) 至P1( 待机点) /// 料仓出库,,把物品放下,,轴2( 上下) 至P8( 进料口出料缓冲点)轴4( 压紧) 至P1( 待机点)
/// </summary> /// </summary>
SO_11_DevicePutWare = 111, SO_14_DevicePutWare,
/// <summary> /// <summary>
/// 料仓出库,,叉子从出料口返回,,轴3( 叉子) 动作至P1( 待机点) /// 料仓出库,,叉子从出料口返回,,轴3( 叉子) 动作至P1( 待机点)
/// </summary> /// </summary>
SO_12_DeviceOutFromDoor = 112, SO_15_InoutBack,
/// <summary> /// <summary>
/// 需要检测到门口有料盘高度 /// 需要检测到门口有料盘高度
/// </summary> /// </summary>
SO_121_CheckHasTray=116, SO_16_CheckHasTray,
/// <summary> /// <summary>
/// 料仓出库,,升降轴返回,, 轴2至P1( 待机点) /// 料仓出库,,升降轴返回,, 轴2至P1( 待机点)
/// </summary> /// </summary>
SO_13_GoBack = 113, SO_17_GoBack,
/// <summary> /// <summary>
/// 等待拿走物品 /// 等待拿走物品
/// </summary> /// </summary>
SO_14_WaitTake=114, SO_18_WaitTake,
#endregion #endregion
...@@ -296,7 +299,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -296,7 +299,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 入库检测 /// 入库检测
/// </summary> /// </summary>
SI_00_TrayCheck=200, SI_00_TrayCheck =200,
/// <summary> /// <summary>
/// 入库,。定位气缸下降 /// 入库,。定位气缸下降
/// </summary> /// </summary>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!