Commit dfbc8272 刘韬

稳定版

1 个父辈 d4b24431
......@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.Common</RootNamespace>
<AssemblyName>Common</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
......
......@@ -99,8 +99,8 @@ namespace OnlineStore.Common
public static string CodeCount = "CodeCount";
public static string CurrShelfNum = "CurrShelfNum";
public static string CurrShelfType = "CurrShelfType";
//public static string CurrShelfNum = "CurrShelfNum";
//public static string CurrShelfType = "CurrShelfType";
//是否有T4进出轴
public static string HasT4Axis = "HasT4Axis";
......@@ -110,6 +110,7 @@ namespace OnlineStore.Common
public static string code_block_size_list = "code_block_size_list";
public static string InstoreEndSendShelf = "InstoreEndSendShelf";
public static string OutstoreEndSendShelf= "OutstoreEndSendShelf";
public static string LastOutShelfType= "LastOutShelfType";
public static string ElectricGripperForce = "ElectricGripperForce";
//public static string LastOutShelfType= "LastOutShelfType";
}
}
......@@ -27,36 +27,39 @@ namespace OnlineStore.Common
public static int HumitureControllerType = ConfigAppSettings.GetIntValue(Setting_Init.HumitureControllerType);
public static bool Init(string port)
{
if (serialBeanMap.ContainsKey(port))
lock (serialBeanMap)
{
return true;
}
LogName = "温湿度传感器[" + port + "]";
AcSerialBean sb = null;
if (HumitureControllerType.Equals(1))
{
bautRate = 9600;//波特率
}
sb = new AcSerialBean(port, bautRate, parity, dataBits, stopBits);
try
{
if (sb.openPort())
if (serialBeanMap.ContainsKey(port))
{
serialBeanMap.Add(port, sb);
return true;
}
else
LogName = "温湿度传感器[" + port + "]";
AcSerialBean sb = null;
if (HumitureControllerType.Equals(1))
{
LogUtil.error( LogName + "串口" + port + "打开失败!");
return false;
bautRate = 9600;//波特率
}
sb = new AcSerialBean(port, bautRate, parity, dataBits, stopBits);
try
{
if (sb.openPort())
{
serialBeanMap.Add(port, sb);
return true;
}
else
{
LogUtil.error(LogName + "串口" + port + "打开失败!");
return false;
}
}
catch (Exception ex)
{
LogUtil.error("串口" + port + "打开失败:" + ex.ToString());
}
return true;
}
catch (Exception ex)
{
LogUtil.error("串口" + port + "打开失败:" + ex.ToString());
}
return true;
}
/// <summary>
/// 释放资源
......
......@@ -2,6 +2,9 @@
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="OnlineStore.DUOStore.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<appSettings>
<!--是否开机自动启动料仓-->
......@@ -60,8 +63,9 @@
<add key="HasT4Axis" value="true"/>
<add key="AgvServerIp" value="192.168.11.11"/>
<add key="Code_Block_Size_List" value="17,19"/>
<add key="InstoreEndSendShelf" value="1" />
<add key="OutstoreEndSendShelf" value="1" />
<add key="InstoreEndSendShelf" value="1"/>
<add key="OutstoreEndSendShelf" value="1"/>
<add key="ElectricGripperForce" value="50"/>
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......@@ -128,4 +132,17 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
<userSettings>
<OnlineStore.DUOStore.Properties.Settings>
<setting name="CurrShelfNum" serializeAs="String">
<value/>
</setting>
<setting name="CurrShelfType" serializeAs="String">
<value>0</value>
</setting>
<setting name="LastOutShelfType" serializeAs="String">
<value>0</value>
</setting>
</OnlineStore.DUOStore.Properties.Settings>
</userSettings>
</configuration>
......@@ -38,7 +38,10 @@
<ApplicationIcon>box.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Agv, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Reference Include="Agv, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\775-agv-net4.6.1\Agv.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary, Version=1.0.7380.18241, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\CodeLibrary.dll</HintPath>
......@@ -127,6 +130,11 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Settings1.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings1.settings</DependentUpon>
</Compile>
<Compile Include="useControl\AxisMoveControl.cs">
<SubType>UserControl</SubType>
</Compile>
......@@ -193,6 +201,10 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<None Include="Settings1.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings1.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config">
......
......@@ -28,6 +28,8 @@ namespace OnlineStore.DUOStore
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmAxisMove));
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.groupInout = new System.Windows.Forms.GroupBox();
this.txtInOutP6 = new System.Windows.Forms.TextBox();
this.btnInOutP6 = new System.Windows.Forms.Button();
this.btnSaveP = new System.Windows.Forms.Button();
this.txtT2P4 = new System.Windows.Forms.TextBox();
this.btnT2P4 = new System.Windows.Forms.Button();
......@@ -65,8 +67,7 @@ namespace OnlineStore.DUOStore
this.btnMiddleP3 = new System.Windows.Forms.Button();
this.axisMoveControl1 = new OnlineStore.DUOStore.AxisMoveControl();
this.btnSotreReset = new System.Windows.Forms.Button();
this.txtInOutP6 = new System.Windows.Forms.TextBox();
this.btnInOutP6 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.groupInout.SuspendLayout();
this.SuspendLayout();
//
......@@ -122,6 +123,40 @@ namespace OnlineStore.DUOStore
this.groupInout.TabStop = false;
this.groupInout.Text = "提升机构位置信息";
//
// txtInOutP6
//
this.txtInOutP6.AcceptsReturn = true;
this.txtInOutP6.BackColor = System.Drawing.SystemColors.Window;
this.txtInOutP6.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtInOutP6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtInOutP6.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtInOutP6.Location = new System.Drawing.Point(583, 185);
this.txtInOutP6.MaxLength = 0;
this.txtInOutP6.Name = "txtInOutP6";
this.txtInOutP6.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtInOutP6.Size = new System.Drawing.Size(89, 23);
this.txtInOutP6.TabIndex = 316;
this.txtInOutP6.Text = "999999";
//
// btnInOutP6
//
this.btnInOutP6.AutoSize = true;
this.btnInOutP6.BackColor = System.Drawing.SystemColors.Control;
this.btnInOutP6.Cursor = System.Windows.Forms.Cursors.Default;
this.btnInOutP6.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnInOutP6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnInOutP6.ForeColor = System.Drawing.Color.DarkGoldenrod;
this.btnInOutP6.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnInOutP6.Location = new System.Drawing.Point(372, 180);
this.btnInOutP6.Name = "btnInOutP6";
this.btnInOutP6.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnInOutP6.Size = new System.Drawing.Size(205, 33);
this.btnInOutP6.TabIndex = 315;
this.btnInOutP6.Text = "T4_进出轴13寸取料点进入前点P6";
this.btnInOutP6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnInOutP6.UseVisualStyleBackColor = false;
this.btnInOutP6.Click += new System.EventHandler(this.btnInOutP6_Click);
//
// btnSaveP
//
this.btnSaveP.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
......@@ -717,45 +752,23 @@ namespace OnlineStore.DUOStore
this.btnSotreReset.UseVisualStyleBackColor = true;
this.btnSotreReset.Click += new System.EventHandler(this.btnSotreReset_Click);
//
// txtInOutP6
//
this.txtInOutP6.AcceptsReturn = true;
this.txtInOutP6.BackColor = System.Drawing.SystemColors.Window;
this.txtInOutP6.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtInOutP6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtInOutP6.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtInOutP6.Location = new System.Drawing.Point(583, 185);
this.txtInOutP6.MaxLength = 0;
this.txtInOutP6.Name = "txtInOutP6";
this.txtInOutP6.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtInOutP6.Size = new System.Drawing.Size(89, 23);
this.txtInOutP6.TabIndex = 316;
this.txtInOutP6.Text = "999999";
// button1
//
// btnInOutP6
//
this.btnInOutP6.AutoSize = true;
this.btnInOutP6.BackColor = System.Drawing.SystemColors.Control;
this.btnInOutP6.Cursor = System.Windows.Forms.Cursors.Default;
this.btnInOutP6.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnInOutP6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnInOutP6.ForeColor = System.Drawing.Color.DarkGoldenrod;
this.btnInOutP6.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnInOutP6.Location = new System.Drawing.Point(372, 180);
this.btnInOutP6.Name = "btnInOutP6";
this.btnInOutP6.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnInOutP6.Size = new System.Drawing.Size(205, 33);
this.btnInOutP6.TabIndex = 315;
this.btnInOutP6.Text = "T4_进出轴13寸取料点进入前点P6";
this.btnInOutP6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnInOutP6.UseVisualStyleBackColor = false;
this.btnInOutP6.Click += new System.EventHandler(this.btnInOutP6_Click);
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Location = new System.Drawing.Point(182, 414);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(128, 39);
this.button1.TabIndex = 276;
this.button1.Text = "夹爪测试";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// FrmAxisMove
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1323, 559);
this.Controls.Add(this.button1);
this.Controls.Add(this.btnSotreReset);
this.Controls.Add(this.groupInout);
this.Controls.Add(this.axisMoveControl1);
......@@ -815,6 +828,7 @@ namespace OnlineStore.DUOStore
private System.Windows.Forms.Button btnSotreReset;
public System.Windows.Forms.TextBox txtInOutP6;
public System.Windows.Forms.Button btnInOutP6;
private System.Windows.Forms.Button button1;
}
}
......@@ -18,6 +18,7 @@ using System.IO.Ports;
using OnlineStore.LoadCSVLibrary;
using CodeLibrary;
using UserFromControl;
using System.Threading.Tasks;
namespace OnlineStore.DUOStore
{
......@@ -233,6 +234,29 @@ namespace OnlineStore.DUOStore
}
}
private void button1_Click(object sender, EventArgs e)
{
Task.Run(()=> {
bool isclamp = false;
int i = 0;
var ec = StoreManager.Store.electricClamp;
ec.OpenPort(StoreManager.Config.Clamp1Port);
while (i < 50)
{
i++;
LogUtil.info($"electricClamp [{i}] isclamp:{isclamp},Action:{(isclamp?"Release":"Clamp")}, IsMoving:{ec.IsMoving}, IsPushEmpty:{ec.IsPushEmpty}, IsReached:{ec.IsReached}, ErrorCode:{ec.ErrorCode}");
if (isclamp) {
if (ec.Release()) {
isclamp = false;
}
}
else if (ec.Clamp()) {
isclamp = true;
}
Task.Delay(100).Wait();
}
});
}
}
}
......@@ -842,7 +842,10 @@ namespace OnlineStore.DUOStore
private void btn_clearTimeout_Click(object sender, EventArgs e)
{
if (BoxBean.alarmType == AlarmType.IoSingleTimeOut)
{
LogUtil.info("用户点击清除IO等待 ");
BoxBean.MoveInfo.EndStepWait();
}
}
}
}
......@@ -522,11 +522,16 @@ namespace OnlineStore.DUOStore
UpdateListBox();
lblWarnMsg.Text = msg;
//if (StoreManager.FrontDoorOpen) {
// lblWarnMsg.Text += "\r\n前门打开, 系统暂停运行,关门后请按复位按钮继续.";
//}
lblAgv.Text = "AGV状态:\n";
lblAgv.Text += $" 入口{StoreManager.Store.Config.AgvInName}:{AgvClient.GetAction(StoreManager.Store.Config.AgvInName)},{AgvClient.GetShelf(StoreManager.Store.Config.AgvInName)}\n";
lblAgv.Text += $" 出口{StoreManager.Store.Config.AgvOutName}:{AgvClient.GetAction(StoreManager.Store.Config.AgvOutName)},{AgvClient.GetShelf(StoreManager.Store.Config.AgvOutName)}\n";
//StoreManager.Store.electricClamp.IsBusy
LogM();
}
......
......@@ -22,5 +22,41 @@ namespace OnlineStore.DUOStore.Properties {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string CurrShelfNum {
get {
return ((string)(this["CurrShelfNum"]));
}
set {
this["CurrShelfNum"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int CurrShelfType {
get {
return ((int)(this["CurrShelfType"]));
}
set {
this["CurrShelfType"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int LastOutShelfType {
get {
return ((int)(this["LastOutShelfType"]));
}
set {
this["LastOutShelfType"] = value;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="OnlineStore.DUOStore.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="CurrShelfNum" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="CurrShelfType" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="LastOutShelfType" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace OnlineStore.DUOStore {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
internal sealed partial class Settings1 : global::System.Configuration.ApplicationSettingsBase {
private static Settings1 defaultInstance = ((Settings1)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings1())));
public static Settings1 Default {
get {
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
</SettingsFile>
......@@ -109,6 +109,11 @@
<Compile Include="device\halcon\CodeManager.cs" />
<Compile Include="device\IO\AIOBOX\AIOBOXManager.cs" />
<Compile Include="device\IO\IOManager.cs" />
<Compile Include="Properties\Settings1.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings1.settings</DependentUpon>
</Compile>
<Compile Include="store\AutoInoutInfo.cs" />
<Compile Include="store\LineMoveP.cs" />
<Compile Include="store\LineAlarm.cs">
......@@ -144,6 +149,11 @@
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="app.config" />
<None Include="Properties\Settings1.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings1.Designer.cs</LastGenOutput>
</None>
<None Include="StoreConfig\box_1_Camera.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
......
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace OnlineStore.DeviceLibrary.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
internal sealed partial class Settings1 : global::System.Configuration.ApplicationSettingsBase {
private static Settings1 defaultInstance = ((Settings1)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings1())));
public static Settings1 Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string CurrShelfNum {
get {
return ((string)(this["CurrShelfNum"]));
}
set {
this["CurrShelfNum"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int CurrShelfType {
get {
return ((int)(this["CurrShelfType"]));
}
set {
this["CurrShelfType"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int LastOutShelfType {
get {
return ((int)(this["LastOutShelfType"]));
}
set {
this["LastOutShelfType"] = value;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="OnlineStore.DeviceLibrary.Properties" GeneratedClassName="Settings1">
<Profiles />
<Settings>
<Setting Name="CurrShelfNum" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="CurrShelfType" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="LastOutShelfType" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>
\ No newline at end of file
......@@ -51,7 +51,7 @@ DI,0,设备左侧防护门关闭端,LeftDoor_Close,36,HC,X36,*,,,,,,,,,
DI,0,设备右侧防护门打开端,RightDoor_Open,37,HC,X37,*,,,,,,,,,
DI,0,设备右侧防护门关闭端,RightDoor_Close,38,HC,X38,*,,,,,,,,,
DI,0,15寸料盘宽度检测,TrayCheck_15,39,HC,X39,*,,,,,,,,,
DI,0,卡爪范围确认,Clamp_InRange,40,HC,X40,*,,,,,,,,,
DI,0,前门门禁信号,FrontDoor_Check,40,HC,X40,*,,,,,,,,,
DI,0,卡爪动作中,Clamp_Busy,41,HC,X41,*,,,,,,,,,
DI,0,卡爪异常代码1,Clamp_Abnormal1,42,HC,X42,*,,,,,,,,,
DI,0,卡爪异常代码2,Clamp_Abnormal2,43,HC,X43,*,,,,,,,,,
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="OnlineStore.DeviceLibrary.Properties.Settings1" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<userSettings>
<OnlineStore.DeviceLibrary.Properties.Settings1>
<setting name="CurrShelfNum" serializeAs="String">
<value/>
</setting>
<setting name="CurrShelfType" serializeAs="String">
<value>0</value>
</setting>
<setting name="LastOutShelfType" serializeAs="String">
<value>0</value>
</setting>
</OnlineStore.DeviceLibrary.Properties.Settings1>
</userSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
......@@ -161,13 +161,13 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(" 【" + cameraName + "】取图片完成,开始扫码");
string r = "";
foreach (int codesize in Code_Block_Size_List)
//foreach (int codesize in Code_Block_Size_List)
{
List<CodeInfo> tlci = EyemDecode.Decoder(ref bmp, null, codesize);
List<CodeInfo> tlci = EyemDecode2.Decoder(ref bmp, null);
foreach (CodeInfo code in tlci)
{
LogUtil.info(" 【" + cameraName + $"】[eyemDecode blocksize:{codesize}]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr);
LogUtil.info(" 【" + cameraName + $"】[eyemDecode]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr);
string str = CodeManager.ReplaceCode(code.CodeStr);
lock (codeList)
{
......@@ -190,7 +190,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
cc = HDCodeHelper.DecodeCode(ho_Image, codeType, GetCodeParamFilePath(codeType), codeCount, 2000);
cc = HDCodeHelper.DecodeCode(ho_Image, codeType, GetCodeParamFilePath(codeType), codeCount, 2500);
}
foreach (CodeInfo c in cc)
{
......
......@@ -115,7 +115,8 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(Name + "启动失败:设备被禁用");
return false;
}
LogInfo("开始启动,启动时间:" + StartTime.ToString());
LogInfo("开始启动,启动时间:" + StartTime.ToString());
WarnMsg = "";
AutoInout.StopAuto();
mainTimer.Enabled = false;
alarmType = AlarmType.None;
......@@ -393,7 +394,7 @@ namespace OnlineStore.DeviceLibrary
&& IOValue(IO_Type.OutDoor_SafeSignal).Equals(IO_VALUE.LOW))
{
OutDoorCloseCountDown--;
while (OutDoorCloseCountDown == 0)
if (OutDoorCloseCountDown == 0)
{
CylinderMove(MoveInfo, IO_Type.OutDoor_Up, IO_Type.OutDoor_Down);
LogInfo("料已被取走,关门");
......
......@@ -55,17 +55,38 @@ namespace OnlineStore.DeviceLibrary
camera.Dispose();
}
void CameraGrabOne(string filename) {
LogUtil.info(Name + "库位文件名:"+ filename);
return;
if (!camera.IsOpen[0]) {
camera.Open(0);
LogUtil.error(Name + "打开监控相机失败2");
}
var rtn = camera.GrabOne(0, out Bitmap bmp);
if (rtn)
try
{
bmp.Save(filename,ImageFormat.Jpeg);
bmp.Dispose();
LogUtil.info(Name + "库位文件名:" + filename);
//return;
if (!camera.IsOpen[0])
{
camera.Open(0);
LogUtil.error(Name + "打开监控相机失败2");
}
var rtn = camera.GrabOne(0, out Bitmap bmp);
if (rtn)
{
if (File.Exists(filename))
File.Delete(filename);
bmp.Save(filename, ImageFormat.Jpeg);
bmp.Dispose();
}
else {
rtn = camera.GrabOne(0, out bmp);
if (rtn)
{
if (File.Exists(filename))
File.Delete(filename);
bmp.Save(filename, ImageFormat.Jpeg);
bmp.Dispose();
}
}
}
catch (Exception e) {
LogUtil.error(Name + e.ToString());
}
}
string GetFixtureStateFilename(InOutParam inOutParam, FixtureState fixtureState) {
......@@ -81,6 +102,7 @@ namespace OnlineStore.DeviceLibrary
enum FixtureState {
In,
Up,
Down,
Out
}
}
......
......@@ -162,7 +162,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsStep(StoreMoveStep.SI_02_AxisBack))
{
if (true || StoreManager.Store.BoxDoorFree(ID))
if (StoreManager.Store.BoxDoorFree(ID))
{
MoveInfo.NextMoveStep(StoreMoveStep.SI_03_InoutToP2);
InOutStoreLog(outType + "进出轴到P2[" + moveP.InOut_P2 + "] ");
......@@ -178,7 +178,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsStep(StoreMoveStep.SI_03_InoutToP2))
{
CameraGrabOne(GetFixtureStateFilename(MoveInfo.MoveParam, FixtureState.In));
MoveInfo.NextMoveStep(StoreMoveStep.SI_04_GetReel);
InOutStoreLog(outType + "升降轴到入料口高点P2 [" + moveP.UpDown_P2 + "],压紧轴到P2 [" + moveP.ComPress_P2 + "] ");
ComAxis.AbsMove(MoveInfo, moveP.ComPress_P2, Config.CompAxis_P2_Speed);
......@@ -186,14 +186,14 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsStep(StoreMoveStep.SI_04_GetReel))
{
CameraGrabOne(GetFixtureStateFilename(MoveInfo.MoveParam, FixtureState.Up));
MoveInfo.NextMoveStep(StoreMoveStep.SI_05_InoutToP1);
InOutStoreLog(outType + "进出轴返回P1 [" + moveP.InOut_P1 + "] ");
InOutBackToP1(moveP.InOut_P1);
}
else if (MoveInfo.IsStep(StoreMoveStep.SI_05_InoutToP1))
{
CameraGrabOne(GetFixtureStateFilename(MoveInfo.MoveParam, FixtureState.Out));
MoveInfo.NextMoveStep(StoreMoveStep.SI_06_FixtureCheck);
InOutStoreLog(outType + "等待料叉检测信号 ");
if (Config.IsUse_Tray_Check.Equals(1))
......@@ -227,6 +227,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsStep(StoreMoveStep.SI_07_InoutToP3))
{
CameraGrabOne(GetFixtureStateFilename(MoveInfo.MoveParam, FixtureState.In));
MoveInfo.NextMoveStep(StoreMoveStep.SI_08_PutReel);
InOutStoreLog(outType + "升降轴到P4[" + moveP.UpDown_P4 + "],压紧轴到P3[" + moveP.ComPress_P3 + "]");
......@@ -240,6 +241,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsStep(StoreMoveStep.SI_08_PutReel))
{
CameraGrabOne(GetFixtureStateFilename(MoveInfo.MoveParam, FixtureState.Down));
MoveInfo.NextMoveStep(StoreMoveStep.SI_09_InoutToP1);
InOutStoreLog(outType + "进出轴返回P1 [" + moveP.InOut_P1 + "] ");
InOutBackToP1(moveP.InOut_P1);
......@@ -247,6 +249,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsStep(StoreMoveStep.SI_09_InoutToP1))
{
CameraGrabOne(GetFixtureStateFilename(MoveInfo.MoveParam, FixtureState.Out));
MoveInfo.NextMoveStep(StoreMoveStep.SI_10_GoBack);
InOutStoreLog(outType + "升降轴到P1[" + moveP.UpDown_P1 + "],旋转轴到P1[" + moveP.Middle_P1 + "] ,压紧轴到P1[" + moveP.ComPress_P1 + "],");
//ComAxis.AbsMove(MoveInfo, moveP.ComPress_P1, Config.CompAxis_P1_Speed);
......@@ -300,7 +303,7 @@ namespace OnlineStore.DeviceLibrary
OutDoorReelType = 2;
else
OutDoorReelType = 1;
InOutStoreLog(outType + "打开出料口门 ");
InOutStoreLog(outType + "打开出料口门 OutDoor_Check:" + IOValue(IO_Type.OutDoor_Check).ToString());
CylinderMove(MoveInfo, IO_Type.OutDoor_Down, IO_Type.OutDoor_Up);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.OutDoor_Check, IO_VALUE.LOW));
}
......@@ -336,7 +339,7 @@ namespace OnlineStore.DeviceLibrary
}
#endregion
#region 出库
private DateTime startOutStoreTime = DateTime.Now;
private void StartExecuctOut(InOutParam param)
......@@ -543,14 +546,14 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StoreMoveStep.SO_06A_04_FixDisk);
InOutStoreLog(outType + "[修正]升降轴到P4[" + fixMoveP.UpDown_P4 + "],压紧轴到P3[" + moveP.ComPress_P3 + "]");
ComAxis.AbsMove(MoveInfo, fixMoveP.ComPress_P3, Config.CompAxis_P3_Speed * 3);
UpdownAxis.AbsMove(MoveInfo, fixMoveP.UpDown_P4, Config.UpDownAxis_P4_Speed * 3);
UpdownAxis.AbsMove(MoveInfo, fixMoveP.UpDown_P4, Config.UpDownAxis_P4_Speed);
}
else if (MoveInfo.IsStep(StoreMoveStep.SO_06A_04_FixDisk))
{
MoveInfo.NextMoveStep(StoreMoveStep.SO_06A_05_FixDisk);
InOutStoreLog(outType + "[修正]升降轴到P6[" + fixMoveP.UpDown_P6 + "],压紧轴到P2[" + fixMoveP.ComPress_P2 + "]");
ComAxis.AbsMove(MoveInfo, fixMoveP.ComPress_P2, Config.CompAxis_P2_Speed * 3);
UpdownAxis.AbsMove(MoveInfo, fixMoveP.UpDown_P6, Config.UpDownAxis_P6_Speed * 3);
UpdownAxis.AbsMove(MoveInfo, fixMoveP.UpDown_P6, Config.UpDownAxis_P6_Speed);
}
else if (MoveInfo.IsStep(StoreMoveStep.SO_06A_05_FixDisk))
{
......
......@@ -38,14 +38,15 @@ namespace OnlineStore.DeviceLibrary
/// 取料提升机构气缸
/// </summary>
//public HoisterCylinder hoisterCylinder = new HoisterCylinder(0);
public ElectricGripper electricClamp = new ElectricGripper();
public ElectricGripper electricClamp = new ElectricGripper(ConfigAppSettings.GetIntValue(Setting_Init.ElectricGripperForce));
public AxisBean T1_BatchAxis = null;
public AxisBean T2_MiddleAxis = null;
public AxisBean T3_UpdownAxis = null;
public AxisBean T4_InOut_Axis = null;
public bool HasT4Axis = false;
int T2_MiddleAxis_Run_Count = 1;
int T2_MiddleAxis_Run_Reset = 3;
/// <summary>
/// 轴列表
/// </summary>
......@@ -174,6 +175,10 @@ namespace OnlineStore.DeviceLibrary
{
SetWarnMsg("启动失败:没有气压信号");
}
else if (IOValue(IO_Type.FrontDoor_Check).Equals(IO_VALUE.LOW))
{
SetWarnMsg("启动失败:前维护门没有关闭");
}
else
{
if (!OpenAllAxis(true))
......@@ -181,6 +186,8 @@ namespace OnlineStore.DeviceLibrary
return false;
}
LogUtil.info(Name + "开始启动 ,启动时间:" + StartTime.ToString());
alarmType = AlarmType.None;
WarnMsg = "";
IOMove(IO_Type.Device_Led, IO_VALUE.HIGH);
RFIDManager.Open();
runStatus = StoreRunStatus.HomeMoving;
......@@ -305,7 +312,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
T1_BatchAxis.AbsMove(MoveInfo, Config.BatchAxis_P1, Config.BatchAxis_P1Speed);
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P2, Config.UpdownAxis_P2Speed);
electricClamp.Release(MoveInfo);
electricClamp.Release();
}
else if (MoveInfo.IsStep(StoreMoveStep.LR_04_BatchToP1))
{
......@@ -321,19 +328,20 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StoreMoveStep.LR_05_Hoister_Back))
{
MoveInfo.NextMoveStep(StoreMoveStep.LR_06_TopDown);
LogUtil.info(Name + "复位 " + MoveInfo.MoveStep + " :顶升气缸下降,旋转轴到待机点P1[" + Config.MiddleAxis_P1 + "]");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
LogUtil.info(Name + "复位 " + MoveInfo.MoveStep + " :顶升气缸下降");
CylinderMove(MoveInfo, IO_Type.TopCylinder_Up, IO_Type.TopCylinder_Down);
T2_MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P1, Config.MiddleAxis_P1Speed);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else if (MoveInfo.IsStep(StoreMoveStep.LR_06_TopDown))
{
MoveInfo.NextMoveStep(StoreMoveStep.LR_07_WaitBox);
CurrShelfNum = ConfigAppSettings.GetValue(Setting_Init.CurrShelfNum);
CurrShelfType = ConfigAppSettings.GetIntValue(Setting_Init.CurrShelfType);
T2_MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P1, Config.MiddleAxis_P1Speed);
CurrShelfNum = Properties.Settings1.Default.CurrShelfNum;
CurrShelfType = Properties.Settings1.Default.CurrShelfType;
UpdateShelfNum(CurrShelfNum, CurrShelfType);
StoreManager.LastVisualRfid = "";
LogUtil.info(Name + "复位 " + MoveInfo.MoveStep + " :等待料仓复位完成");
LogUtil.info(Name + "复位 " + MoveInfo.MoveStep + " :,旋转轴到待机点P1[" + Config.MiddleAxis_P1 + "],等待料仓复位完成");
}
else if (MoveInfo.IsStep(StoreMoveStep.LR_07_WaitBox))
{
......@@ -630,7 +638,7 @@ namespace OnlineStore.DeviceLibrary
}
}
}
else if (IOValue(IO_Type.Reset_BTN).Equals(IO_VALUE.HIGH))
else if (!StoreManager.FrontDoorOpen && IOValue(IO_Type.Reset_BTN).Equals(IO_VALUE.HIGH))
{
//收到复位信号,若报警直接复位,若不报警且无操作,回到待机点
if (alarmType.Equals(AlarmType.None) && isInSuddenDown.Equals(false) && isNoAirCheck.Equals(false))
......@@ -654,6 +662,27 @@ namespace OnlineStore.DeviceLibrary
}
AirCheckProcess();
}
if (!StoreManager.FrontDoorOpen && IOValue(IO_Type.FrontDoor_Check).Equals(IO_VALUE.LOW))
{
StoreManager.FrontDoorOpen = true;
LogUtil.info("收到前门打开信号,系统暂停运行");
}
else if (StoreManager.FrontDoorOpen && IOValue(IO_Type.Reset_BTN).Equals(IO_VALUE.HIGH))
{
LogUtil.info("收到复位按钮信号,系统恢复运行");
StoreManager.FrontDoorOpen = false;
Thread.Sleep(500);
WarnMsg = "";
BoxMap[1].WarnMsg = "";
BoxMap[2].WarnMsg = "";
}
else if (StoreManager.FrontDoorOpen){
WarnMsg = "前门打开, 系统暂停运行,关门后请按复位按钮继续.";
}
}
catch(Exception ex)
{
......@@ -684,7 +713,12 @@ namespace OnlineStore.DeviceLibrary
//检查运动轴报警
if (runStatus > StoreRunStatus.Wait && (!isInSuddenDown) && (!isNoAirCheck))
{
CheckAxisAlarm(new AxisBean[] { T1_BatchAxis, T2_MiddleAxis, T3_UpdownAxis });
List<AxisBean> axislist = new List<AxisBean> { T3_UpdownAxis, T2_MiddleAxis, T1_BatchAxis };
if (StoreManager.Store.HasT4Axis)
{
axislist.Add(T4_InOut_Axis);
}
CheckAxisAlarm(axislist.ToArray());
ShowTimeLog("轴报警检测完成");
}
......@@ -803,10 +837,13 @@ namespace OnlineStore.DeviceLibrary
Agv.ClientShelf AgvNeedOutshelf = Agv.ClientShelf.None;
void IOMinoitor() {
// bool isLineEmpty = IOValue(IO_Type.Line_WaitCheck).Equals(IO_VALUE.LOW) || IOValue(IO_Type.Line_WaitCheck).Equals(IO_VALUE.LOW);
LogUtil.OutputDebugString($"IOMinoitor Line_OutCheck:{IOValue(IO_Type.Line_OutCheck)},Line_WaitCheck:{IOValue(IO_Type.Line_WaitCheck)},MoveType:{MoveInfo.MoveType},Box1Count:{BoxMap[1].waitOutStoreList.Count},Box2Count:{BoxMap[2].waitOutStoreList.Count},{Config.AgvInName}:{AgvClient.GetAction(Config.AgvInName)},{AgvClient.GetShelf(Config.AgvInName)}");
bool boxwaitout = BoxMap[1].MoveInfo.MoveStep == StoreMoveStep.SO_11_GoBack || BoxMap[2].MoveInfo.MoveStep == StoreMoveStep.SO_11_GoBack;
// bool isLineEmpty = IOValue(IO_Type.Line_WaitCheck).Equals(IO_VALUE.LOW) || IOValue(IO_Type.Line_WaitCheck).Equals(IO_VALUE.LOW);
bool AgvNeedEmpty = (DateTime.Now - StoreManager.AgvNeedEmptyTime).TotalSeconds < 10;
bool boxwaitout = BoxMap[1].MoveInfo.MoveStep == StoreMoveStep.SO_11_GoBack || BoxMap[2].MoveInfo.MoveStep == StoreMoveStep.SO_11_GoBack || AgvNeedEmpty;
bool boxmovetype = BoxMap[1].MoveInfo.MoveType == MoveType.OutStore || BoxMap[2].MoveInfo.MoveType == MoveType.OutStore;
LogUtil.OutputDebugString($"IOMinoitor AgvNeedEmpty:{AgvNeedEmpty}, Line_OutCheck:{IOValue(IO_Type.Line_OutCheck)},Line_WaitCheck:{IOValue(IO_Type.Line_WaitCheck)},MoveType:{MoveInfo.MoveType},Box1Count:{BoxMap[1].waitOutStoreList.Count},Box2Count:{BoxMap[2].waitOutStoreList.Count},boxwaitout:{boxwaitout},boxmovetype:{boxmovetype},{Config.AgvInName}:{AgvClient.GetAction(Config.AgvInName)},{AgvClient.GetShelf(Config.AgvInName)}");
//有料盘正在舱口等待出库
if (boxwaitout && MoveInfo.MoveType.Equals(MoveType.None)
&& (AgvClient.GetAction(Config.AgvInName) != Agv.ClientAction.NeedEnter || AgvClient.GetShelf(Config.AgvInName)!= Agv.ClientShelf.Empty) )
......@@ -816,7 +853,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(Name + "IOMinoitor AgvClient.NeedEnter:" + Config.AgvInName + ",AgvNeedInshelf:" + AgvClient.GetShelf(Config.AgvInName));
}
//线体等待区没有料串,同时没有出库任务
else if (IOValue(IO_Type.Line_WaitCheck).Equals(IO_VALUE.LOW) && AgvClient.GetAction(Config.AgvInName) == Agv.ClientAction.None
else if (IOValue(IO_Type.Line_WaitCheck).Equals(IO_VALUE.LOW) && (AgvClient.GetAction(Config.AgvInName) == Agv.ClientAction.None || AgvClient.GetShelf(Config.AgvInName) == Agv.ClientShelf.Empty)
&& BoxMap[1].waitOutStoreList.Count == 0 && BoxMap[2].waitOutStoreList.Count == 0 && !boxwaitout && !boxmovetype) //&& MoveInfo.MoveType.Equals(MoveType.None) //线体不在运动中
{
//排除单盘出库任务
......@@ -834,7 +871,7 @@ namespace OnlineStore.DeviceLibrary
var rfiddevice = RFIDManager.GetShelfId(Config.Out_Rfid_IP);
var rfid = rfiddevice.NumStr();
if (AgvNeedOutshelf == Agv.ClientShelf.None) {
if (ConfigAppSettings.GetIntValue(Setting_Init.LastOutShelfType) == 1)
if (Properties.Settings1.Default.LastOutShelfType == 1)
AgvNeedOutshelf = Agv.ClientShelf.Full;
else
AgvNeedOutshelf = Agv.ClientShelf.Empty;
......@@ -891,7 +928,7 @@ namespace OnlineStore.DeviceLibrary
{
if (move != null)
{
move.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_Run, IO_VALUE.HIGH));
//move.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_Run, IO_VALUE.HIGH));
}
LineRun("n", 999, parentname);
}
......@@ -900,7 +937,7 @@ namespace OnlineStore.DeviceLibrary
{
if (move != null)
{
move.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_Run, IO_VALUE.LOW));
//move.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Line_Run, IO_VALUE.LOW));
}
LineStop("n", parentname);
}
......@@ -916,7 +953,12 @@ namespace OnlineStore.DeviceLibrary
}
public bool OpenAllAxis(bool isCheck = true)
{
if (RunMultiAxis(isCheck, new AxisBean []{ T3_UpdownAxis,T2_MiddleAxis,T4_InOut_Axis, T1_BatchAxis }))
List<AxisBean> axislist = new List<AxisBean> { T3_UpdownAxis, T2_MiddleAxis, T1_BatchAxis };
if (StoreManager.Store.HasT4Axis)
{
axislist.Add(T4_InOut_Axis);
}
if (RunMultiAxis(isCheck, axislist.ToArray()))
{
return true;
//if (RunAxis(isCheck, T1_BatchAxis) )
......@@ -927,7 +969,18 @@ namespace OnlineStore.DeviceLibrary
public void CloseAllAxis()
{
CloseMultiAxis(new AxisBean[] { T3_UpdownAxis, T2_MiddleAxis, T4_InOut_Axis, T1_BatchAxis });
List<AxisBean> axislist = new List<AxisBean> { T3_UpdownAxis, T2_MiddleAxis, T1_BatchAxis };
if (StoreManager.Store.HasT4Axis)
{
axislist.Add(T4_InOut_Axis);
}
CloseMultiAxis(axislist.ToArray());
//CloseAxis(T1_BatchAxis);
}
public void ClearAlarmAllAxis()
{
var x = new List<AxisBean> { T3_UpdownAxis, T2_MiddleAxis, T4_InOut_Axis, T1_BatchAxis };
x.ForEach((ax) => { AxisManager.instance.AlarmClear(ax.Config.DeviceName, ax.Config.GetAxisValue()); });
//CloseAxis(T1_BatchAxis);
}
}
......
......@@ -29,12 +29,14 @@ namespace OnlineStore.DeviceLibrary
{
CurrShelfNum = num;
ConfigAppSettings.SaveValue(Setting_Init.CurrShelfNum, num);
Properties.Settings1.Default.CurrShelfNum = num;
//ConfigAppSettings.SaveValue(Setting_Init.CurrShelfNum, num);
CurrShelfType = type;
ConfigAppSettings.SaveValue(Setting_Init.CurrShelfType, type);
Properties.Settings1.Default.CurrShelfType = type;
//ConfigAppSettings.SaveValue(Setting_Init.CurrShelfType, type);
Properties.Settings1.Default.Save();
if (type.Equals(0) || type.Equals(1))
{
outStoreCount = 0;
......@@ -123,7 +125,8 @@ namespace OnlineStore.DeviceLibrary
bool isLineEmpty = IOValue(IO_Type.Line_WaitCheck).Equals(IO_VALUE.LOW);
if (IsStart && isLineEmpty && (AgvClient.GetAction(Config.AgvInName) == Agv.ClientAction.None || AgvClient.GetAction(Config.AgvInName) == Agv.ClientAction.NeedEnter) && AgvClient.GetShelf(Config.AgvInName) != Agv.ClientShelf.Empty)
{
AgvNeedInshelf= Agv.ClientShelf.Empty;
StoreManager.AgvNeedEmptyTime = DateTime.Now;
AgvNeedInshelf = Agv.ClientShelf.Empty;
AgvClient.SetToNone(Config.AgvInName);
AgvClient.NeedEnter(Config.AgvInName, "", AgvNeedInshelf);
LogUtil.info(Name + "CanOut AgvClient.NeedEnter" + Config.AgvInName + ",AgvNeedInshelf:" + AgvNeedInshelf);
......@@ -363,13 +366,24 @@ namespace OnlineStore.DeviceLibrary
}
else if (MoveInfo.IsStep(StoreMoveStep.LO_13_UpdownDown))
{
MoveInfo.NextMoveStep(StoreMoveStep.LO_14_CylinderTighten);
InOutStoreLog("取料:夹爪气缸夹紧");
electricClamp.Clamp(null, MoveInfo.MoveParam.PlateW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
if (electricClamp.Clamp(null))
{
MoveInfo.NextMoveStep(StoreMoveStep.LO_14_CylinderTighten);
InOutStoreLog("取料:夹爪气缸夹紧");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
}
else if (MoveInfo.IsTimeOut(10))
{
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "] 等待 电夹爪空闲 超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, ID * 1000 + 30);
Alarm(AlarmType.IoSingleTimeOut);
}
}
else if (MoveInfo.IsStep(StoreMoveStep.LO_14_CylinderTighten))
{
ClearTimeoutAlarm("电夹爪空闲");
MoveInfo.NextMoveStep(StoreMoveStep.LO_15a_UpdownUp);
if (MoveInfo.MoveParam.TargetBox.Equals(1))
{
......@@ -398,8 +412,6 @@ namespace OnlineStore.DeviceLibrary
T4_InOut_Axis.AbsMove(MoveInfo, Config.InOutAxis_P1, Config.InOutAxis_P1Speed);
}
}
}
else if (MoveInfo.IsStep(StoreMoveStep.LO_15_UpdownUp))
{
......@@ -410,7 +422,8 @@ namespace OnlineStore.DeviceLibrary
}
MoveInfo.NextMoveStep(StoreMoveStep.LO_16_MiddleToP1);
InOutStoreLog("取料:旋转轴到料串位置P4 [" + Config.MiddleAxis_P4 + "]");
T2_MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P4, Config.MiddleAxis_P1Speed);
T2_MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P4, Config.MiddleAxis_P4Speed);
//T2_MiddleAxis_Run_Count++;
}
else if (MoveInfo.IsStep(StoreMoveStep.LO_16_MiddleToP1))
......@@ -423,28 +436,37 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.NextMoveStep(StoreMoveStep.LO_18_UpdownDown);
InOutStoreLog("取料:升降轴到料串放料低点P1 [" + Config.UpdownAxis_P1 + "]");
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P1, (int)(Config.UpdownAxis_P1Speed*2));
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P1, (int)(Config.UpdownAxis_P1Speed * 2));
}
else if (MoveInfo.IsStep(StoreMoveStep.LO_18_UpdownDown))
{
MoveInfo.NextMoveStep(StoreMoveStep.LO_19_CylinderRelax);
InOutStoreLog("料盘移栽: 夹爪气缸放松");
electricClamp.Release(MoveInfo);
if (electricClamp.Release()) {
MoveInfo.NextMoveStep(StoreMoveStep.LO_19_CylinderRelax);
InOutStoreLog("料盘移栽: 夹爪气缸放松");
}
else if (MoveInfo.IsTimeOut(10))
{
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "] 等待 电夹爪空闲 超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, ID * 1000 + 30);
Alarm(AlarmType.IoSingleTimeOut);
}
}
else if (MoveInfo.IsStep(StoreMoveStep.LO_19_CylinderRelax))
{
ClearTimeoutAlarm("电夹爪空闲");
MoveInfo.NextMoveStep(StoreMoveStep.LO_20_BatchAxisToP2);
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P2, Config.UpdownAxis_P2Speed);
InOutStoreLog("料盘移栽: 升降轴上升到P2");
}
else if (MoveInfo.IsStep(StoreMoveStep.LO_20_BatchAxisToP2))
{
MoveInfo.NextMoveStep(StoreMoveStep.LO_20_UpdownUp);
MoveInfo.NextMoveStep(StoreMoveStep.LO_20a_UpdownUp);
//只有提升轴位置过低时才需要到P3
int currPosition = T1_BatchAxis.GetAclPosition();
int reoppos = (Config.BatchAxis_P1 + Config.BatchAxis_ChangeValue * 100);
InOutStoreLog($"料盘移栽: 当前T1位置[{currPosition}],最低需要重新上升位置:[{reoppos}]");
if (currPosition <= reoppos && TrayStringUpFix<2)
if (currPosition <= reoppos && TrayStringUpFix < 2)
{
MoveInfo.NextMoveStep(StoreMoveStep.LO_20_UpdownUp_wait);
TrayStringUpFix++;
......@@ -455,22 +477,44 @@ namespace OnlineStore.DeviceLibrary
{
InOutStoreLog("料盘移栽: 升降轴到料串高点[" + Config.UpdownAxis_P2 + "],提升轴[" + currPosition + "]不需要到P2");
}
if (HasT4Axis)
T4_InOut_Axis.AbsMove(MoveInfo, Config.InOutAxis_P1, Config.InOutAxis_P1Speed);
}
else if (MoveInfo.IsStep(StoreMoveStep.LO_20_UpdownUp_wait))
{
MoveInfo.NextMoveStep(StoreMoveStep.LO_20_UpdownUp);
MoveInfo.NextMoveStep(StoreMoveStep.LO_20a_UpdownUp);
int currPosition = T1_BatchAxis.GetAclPosition();
int targetP2 = currPosition - Config.BatchAxis_ChangeValue * 20;
T1_BatchAxis.AbsMove(MoveInfo, targetP2, Config.BatchAxis_P1);
InOutStoreLog($"料盘移栽: 料串下降当前位置:{currPosition},目标位置:{targetP2}");
T1_BatchAxis.AbsMove(MoveInfo, targetP2, Config.BatchAxis_P1Speed);
}
else if (MoveInfo.IsStep(StoreMoveStep.LO_20a_UpdownUp))
{
if (T2_MiddleAxis_Run_Count > T2_MiddleAxis_Run_Reset)
MoveInfo.NextMoveStep(StoreMoveStep.LO_20b_UpdownUp);
else
{
MoveInfo.NextMoveStep(StoreMoveStep.LO_20_UpdownUp);
return;
}
T2_MiddleAxis_Run_Count = 0;
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P6, Config.UpdownAxis_P2Speed);
T2_MiddleAxis.HomeMove(MoveInfo);
InOutStoreLog($"取料:取料旋转轴运动满100次开始回原复位{T2_MiddleAxis_Run_Count}");
}
else if (MoveInfo.IsStep(StoreMoveStep.LO_20b_UpdownUp))
{
MoveInfo.NextMoveStep(StoreMoveStep.LO_20_UpdownUp);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
InOutStoreLog($"料盘移栽: 等待");
}
else if (MoveInfo.IsStep(StoreMoveStep.LO_20_UpdownUp))
{
MoveInfo.NextMoveStep(StoreMoveStep.LO_21_NeedSendShelf);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
InOutStoreLog("料盘移栽:判断是否送出料架");
if (HasT4Axis)
T4_InOut_Axis.AbsMove(MoveInfo, Config.InOutAxis_P1, Config.InOutAxis_P1Speed);
if (T2_MiddleAxis_Run_Count==0)
T2_MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P4, Config.MiddleAxis_P4Speed);
int currPositon = T1_BatchAxis.GetAclPosition();
int tp = currPositon - Config.BatchAxis_ChangeValue * 60;
......@@ -523,7 +567,9 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StoreMoveStep.LO_34_WorkStopDown);
InOutStoreLog("送出料架:流水线开始转动");
UpdateShelfNum(CurrShelfNum, -1);
ConfigAppSettings.SaveValue(Setting_Init.LastOutShelfType, 1);
Properties.Settings1.Default.LastOutShelfType = 1;
Properties.Settings1.Default.Save();
//ConfigAppSettings.SaveValue(Setting_Init.LastOutShelfType, 1);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
LineRun(MoveInfo);
}
......@@ -566,6 +612,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StoreMoveStep.LO_31_BatchAxisToP1);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000));
InOutStoreLog("出库 :" + msg + "开始送出料架,提升伺服到P1点 ["+ Config.BatchAxis_P1 + "] ");
StoreManager.LastVisualRfid = "";
UpdateShelfNum(CurrShelfNum, 0);
T1_BatchAxis.SuddenStop();
T1_BatchAxis.AbsMove(MoveInfo, Config.BatchAxis_P1, Config.BatchAxis_P2Speed);
......@@ -762,7 +809,7 @@ namespace OnlineStore.DeviceLibrary
}
return false ;
}
protected override void InStoreProcess()
{
if (MoveInfo.IsInWait)
......@@ -803,14 +850,14 @@ namespace OnlineStore.DeviceLibrary
LineStop(MoveInfo);
InOutStation_RasieUp();
OpenGate(MoveInfo);
CurrShelfNum = ConfigAppSettings.GetValue(Setting_Init.CurrShelfNum);
CurrShelfType = ConfigAppSettings.GetIntValue(Setting_Init.CurrShelfType);
CurrShelfNum = Properties.Settings1.Default.CurrShelfNum;
CurrShelfType = Properties.Settings1.Default.CurrShelfType;
var rfiddevice = RFIDManager.GetShelfId(Config.In_Rfid_IP);
var rfid = rfiddevice.NumStr();
InOutStoreLog($"入料检测:读取到rfid: {rfid}");
if (rfid == "000")
{
rfid =CurrShelfNum;
rfid = CurrShelfNum;
}
if (rfid == CurrShelfNum && CurrShelfType == 2)
{
......@@ -818,7 +865,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
CurrShelfType = 1;
CurrShelfType = 1;
}
UpdateShelfNum(rfid, CurrShelfType);
}
......@@ -857,6 +904,7 @@ namespace OnlineStore.DeviceLibrary
T4_InOut_Axis.AbsMove(MoveInfo, Config.InOutAxis_P1, Config.InOutAxis_P1Speed);
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P2, Config.UpdownAxis_P2Speed);
T2_MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P4, Config.MiddleAxis_P4Speed);
//T2_MiddleAxis_Run_Count++;
}
#endregion
......@@ -879,14 +927,23 @@ namespace OnlineStore.DeviceLibrary
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P1, Config.UpdownAxis_P1Speed);
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_12_UpdownAxisToP3))
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_13_CylinderTighten);
InOutStoreLog("取料:夹爪气缸夹紧");
electricClamp.Clamp(null);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
{
if (electricClamp.Clamp(null))
{
InOutStoreLog("取料:夹爪气缸夹紧");
MoveInfo.NextMoveStep(StoreMoveStep.LI_13_CylinderTighten);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
}
else if (MoveInfo.IsTimeOut(10)) {
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "] 等待 电夹爪空闲 超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, ID * 1000 + 30);
Alarm(AlarmType.IoSingleTimeOut);
}
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_13_CylinderTighten))
{
ClearTimeoutAlarm("电夹爪空闲");
MoveInfo.NextMoveStep(StoreMoveStep.LI_14_UpdownToP1);
InOutStoreLog("取料:升降轴到料串高点P2[" + Config.UpdownAxis_P2 + "]");
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P2, Config.UpdownAxis_P2Speed);
......@@ -945,7 +1002,8 @@ namespace OnlineStore.DeviceLibrary
if (LastPosParam.InStoreNg)
{
int box = GetInstoreNgBox();
if (HasT4Axis) {
if (HasT4Axis)
{
if (LastWidth >= 13)
box = 2;
else
......@@ -1002,7 +1060,7 @@ namespace OnlineStore.DeviceLibrary
bool waitRightLeave = false;
if (HasT4Axis && storeId == 1 && (IOManager.IOValue(IO_Type.InDoor_Check, 2).Equals(IO_VALUE.HIGH) || (BoxMap[2].MoveInfo.MoveStep< StoreMoveStep.SI_05_InoutToP1 && BoxMap[2].MoveInfo.MoveStep > StoreMoveStep.SI_03_InoutToP2)))
if (HasT4Axis && storeId == 1 && (IOManager.IOValue(IO_Type.InDoor_Check, 2).Equals(IO_VALUE.HIGH) || (BoxMap[2].MoveInfo.MoveStep < StoreMoveStep.SI_05_InoutToP1 && BoxMap[2].MoveInfo.MoveStep > StoreMoveStep.SI_03_InoutToP2)))
{
waitRightLeave = true;
}
......@@ -1066,22 +1124,31 @@ namespace OnlineStore.DeviceLibrary
if (LastPosParam.TargetBox.Equals(1))
{
InOutStoreLog($"料盘移栽: 升降轴到料门口低点P3[{Config.UpdownAxis_P3},补偿:{(LastHeight - 8) * Config.UpdownAxis_ChangeValue}],开始预扫码");
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P3 - (LastHeight - 8) * Config.UpdownAxis_ChangeValue, (int)(Config.UpdownAxis_P3Speed*2));
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P3 - (LastHeight - 8) * Config.UpdownAxis_ChangeValue, (int)(Config.UpdownAxis_P3Speed * 2));
}
else
{
InOutStoreLog($"料盘移栽: 升降轴到料门口低点P5[{Config.UpdownAxis_P5},补偿:{(LastHeight - 8) * Config.UpdownAxis_ChangeValue}],开始预扫码");
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P5 - (LastHeight - 8) * Config.UpdownAxis_ChangeValue, (int)(Config.UpdownAxis_P5Speed*2));
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P5 - (LastHeight - 8) * Config.UpdownAxis_ChangeValue, (int)(Config.UpdownAxis_P5Speed * 2));
}
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_23_UpdownDown))
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_24_CylinderRelax);
InOutStoreLog("料盘移栽: 上料气缸放松");
electricClamp.Release(MoveInfo);
if (electricClamp.Release())
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_24_CylinderRelax);
InOutStoreLog("料盘移栽: 上料气缸放松");
}
else if (MoveInfo.IsTimeOut(10))
{
WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "] 等待 电夹爪空闲 超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, ID * 1000 + 30);
Alarm(AlarmType.IoSingleTimeOut);
}
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_24_CylinderRelax))
{
ClearTimeoutAlarm("电夹爪空闲");
MoveInfo.NextMoveStep(StoreMoveStep.LI_25_UpdownUp);
if (LastPosParam.TargetBox.Equals(1))
{
......@@ -1102,9 +1169,19 @@ namespace OnlineStore.DeviceLibrary
InOutStoreLog($"料盘移栽:storeId={storeId},targetpos={LastPosParam.TargetPosition},isNG={LastPosParam.InStoreNg}");
box.waitInStoreParam = LastPosParam.clone();
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_25_UpdownUp))
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_26_AxisToWait);
if (T2_MiddleAxis_Run_Count > T2_MiddleAxis_Run_Reset)
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_25a_UpdownUp);
}
else
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_26_AxisToWait);
//return;
}
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
InOutStoreLog("料盘移栽:旋转轴返回待机点P1[" + Config.MiddleAxis_P1 + "],升降轴到料串高点P2[" + Config.UpdownAxis_P2 + "]进出轴回P1");
//T2_MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P1, Config.MiddleAxis_P1Speed);
......@@ -1112,6 +1189,13 @@ namespace OnlineStore.DeviceLibrary
if (HasT4Axis)
T4_InOut_Axis.AbsMove(MoveInfo, Config.InOutAxis_P1, Config.InOutAxis_P1Speed);
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_25a_UpdownUp))
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_26_AxisToWait);
T2_MiddleAxis_Run_Count = 0;
T2_MiddleAxis.HomeMove(MoveInfo);
InOutStoreLog("取料:取料旋转轴运动满100次开始回原复位");
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_26_AxisToWait))
{
CheckHasTray();
......@@ -1147,7 +1231,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StoreMoveStep.LI_33_TopCylinderDown_3);
InOutStoreLog("送出料架:进出机构下降");
InOutStation_RasieDown();
}
else if (MoveInfo.IsStep(StoreMoveStep.LI_33_TopCylinderDown_3))
{
......@@ -1170,12 +1254,13 @@ namespace OnlineStore.DeviceLibrary
}
//判断是否需要送出料架,如果入口和等待区无料架,暂不送出
else */
if (true || IOValue(IO_Type.Line_InCheck).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.Line_WaitCheck).Equals(IO_VALUE.HIGH) || InstoreEndSendShelf)
if (true || IOValue(IO_Type.Line_InCheck).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.Line_WaitCheck).Equals(IO_VALUE.HIGH) || InstoreEndSendShelf)
{
MoveInfo.NextMoveStep(StoreMoveStep.LI_34_WorkStopDown);
InOutStoreLog("送出料架[" + InstoreEndSendShelf + "]:上料阻挡下降1秒,流水线开始转动");
UpdateShelfNum(CurrShelfNum, -1);
ConfigAppSettings.SaveValue(Setting_Init.LastOutShelfType,0);
Properties.Settings1.Default.LastOutShelfType = 0;
Properties.Settings1.Default.Save();
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
LineRun(MoveInfo);
IOMove(IO_Type.Line_Stop2_Work, IO_VALUE.HIGH, false, 1000);
......@@ -1293,6 +1378,7 @@ namespace OnlineStore.DeviceLibrary
InOutStoreLog("入料检测:有料盘:升降轴到料串高点P2 ["+ Config.UpdownAxis_P2 + "],旋转轴到料串位置P4 ["+ Config.MiddleAxis_P4 + "]");
T3_UpdownAxis.AbsMove(MoveInfo, Config.UpdownAxis_P2, Config.UpdownAxis_P2Speed);
T2_MiddleAxis.AbsMove(MoveInfo, Config.MiddleAxis_P4, Config.MiddleAxis_P4Speed);
//T2_MiddleAxis_Run_Count++;
}
Task<List<string>> scanTask;
private void LI_09_ScanCode()
......@@ -1574,7 +1660,7 @@ namespace OnlineStore.DeviceLibrary
{
if (MoveInfo.MoveType.Equals(MoveType.OutStore))
{
if (MoveInfo.MoveStep >= StoreMoveStep.LO_13_UpdownDown && MoveInfo.MoveStep <= StoreMoveStep.LO_16_MiddleToP1)
if (MoveInfo.MoveStep >= StoreMoveStep.LO_13_UpdownDown && MoveInfo.MoveStep <= StoreMoveStep.LO_15_UpdownUp)
{
if (MoveInfo.MoveParam.TargetBox.Equals(id))
{
......
using OnlineStore.LoadCSVLibrary;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
......@@ -10,8 +12,12 @@ namespace OnlineStore.DeviceLibrary
public class ElectricGripper
{
private int subType = 0;
private Neotel.Rmaxis axis;
public Neotel.Rmaxis axis;
private int Force=50;
public Enum GripperType = GripperTypeE.None;
public ElectricGripper(int force){
Force = force;
}
public bool OpenPort(string port)
{
axis = new Neotel.Rmaxis();
......@@ -22,57 +28,76 @@ namespace OnlineStore.DeviceLibrary
public void ClosePort() {
axis.ClosePort();
}
public void Clamp(StoreMoveInfo moveInfo = null,int plateW=7)
public bool Clamp(StoreMoveInfo moveInfo = null,int plateW=7)
{
GripperType = GripperTypeE.Gripper;
if (!IsBusy)
{
//if (plateW > 7)
if (true)
try
{
axis.Push(99, 7, 10);
axis.Push(Force, 4.5f, 15);
}
else
{
axis.Push(50, 7, 10);
catch(Exception e) {
LogUtil.info(e.ToString());
return false;
}
if (moveInfo!=null)
moveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
return true;
}
if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(WaitAction)));
return false;
}
public bool Release(StoreMoveInfo moveInfo = null)
{
GripperType = GripperTypeE.Release;
if (!IsBusy)
{
axis.GoHome();
//axis.StopAxis();
//Thread.Sleep(500);
axis.MoveAbsolute(0, 30, 500, 500, 0.1f);
if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
return true;
}
else
{
//axis.StopAxis();
//Thread.Sleep(500);
//axis.GoHome();
if (moveInfo != null)
moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(WaitAction)));
return false;
}
}
public void HomeReset(StoreMoveInfo moveInfo = null) {
public void HomeReset(StoreMoveInfo moveInfo = null)
{
GripperType = GripperTypeE.Reset;
//if (!IsBusy)
//{
axis.ResetError();
axis.GoHome();
// }
axis.StopAxis();
axis.ResetError();
axis.GoHome();
// }
//if (moveInfo != null)
// moveInfo.WaitList.Add(WaitResultInfo.WaitAction(new Func<WaitResultInfo, bool>(WaitAction)));
}
public bool IsBusy {
get {
//axis.GetPosition();
return !axis.IsReached;
LogUtil.info($"ElectricGripper IsReached:{axis.IsReached},IsMoving:{axis.IsMoving},Pos:{axis.GetPosition()}");
//return false;
try
{
return !axis.IsReached;
}
catch (Exception e)
{
LogUtil.info(e.ToString());
return true;
}
}
}
public bool IsClamp {
......@@ -82,6 +107,10 @@ namespace OnlineStore.DeviceLibrary
return !axis.IsPushEmpty;
}
}
public bool IsPushEmpty { get => axis.IsPushEmpty; }
public bool IsMoving { get => axis.IsMoving; }
public bool IsReached { get => axis.IsReached; }
public int ErrorCode { get => axis.ErrorCode; }
bool WaitAction(WaitResultInfo w)
{
......
......@@ -72,7 +72,12 @@ namespace OnlineStore.DeviceLibrary
{
InProcess = true;
stopwatch.Restart();
TimerProcess();
if (!StoreManager.FrontDoorOpen)
TimerProcess();
else
{
WarnMsg="前维护门打开,系统暂停运行.";
}
ShowTimeLog("TimerProcess");
}
catch (Exception ex)
......
......@@ -67,11 +67,14 @@ namespace OnlineStore.DeviceLibrary
private float StartBlowValue = (float)ConfigAppSettings.GetNumValue(Setting_Init.StartBlowValue);
private float StopBlowValue = (float)ConfigAppSettings.GetNumValue(Setting_Init.StopBlowValue);
public string currTempStr = "";
Random num = new Random();
internal void HumidityProcess(BoxBean box)
{
try
{
if ((DateTime.Now - preLogTime).TotalSeconds > 10)
int rad = num.Next(9, 13);
if ((DateTime.Now - preLogTime).TotalSeconds > rad)
{
preLogTime = DateTime.Now;
HumitureParam param = QueryData();
......
......@@ -24,8 +24,18 @@ namespace OnlineStore.DeviceLibrary
public static string LastVisualRfid = "";
public volatile static bool ShelfNeedOut = false;
public StoreManager()
public static bool FrontDoorOpen = false;
public static DateTime AgvNeedEmptyTime = DateTime.Now;
static StoreManager()
{
//var CurrShelfNum = Properties.Settings1.Default.CurrShelfNum;
//Properties.Settings1.Default.CurrShelfNum = "12";
//Properties.Settings1.Default.Save();
//CurrShelfNum = Properties.Settings1.Default.CurrShelfNum;
}
#region 配置文件加载更新
......@@ -345,6 +355,7 @@ namespace OnlineStore.DeviceLibrary
}
private static string spiltStr = "##";
private static string Addr_PosForPutin = "/service/store/emptyPosForPutin";
private static bool r=false;
public static GetPosResult GetPosId(string deviceName, List<string> codeList, int height, int width, string shelfNum)
{
GetPosResult result = new GetPosResult();
......@@ -367,18 +378,22 @@ namespace OnlineStore.DeviceLibrary
// 参数:cids: 多个 cid
//code: 条码内容
Dictionary<string, string> paramMap = new Dictionary<string, string>();
string cids = "";
List<string> cids = new List<string>();
foreach(int k in Store.BoxMap.Keys)
{
//if (Store.BoxMap[k].runStatus > StoreRunStatus.Wait && Store.BoxMap[k].IOValue(IO_Type.InDoor_Check).Equals(IO_VALUE.LOW))
if (!Store.BoxMap[k].IsDebug && !Store.BoxMap[k].Disabled && Store.BoxMap[k].runStatus > StoreRunStatus.Wait)
{
cids += Store.BoxMap[k].CID+",";
cids.Add(Store.BoxMap[k].CID);
}
}
cids = cids.TrimEnd(',');
paramMap.Add("cids", cids);
if (r)
{
r = false;
cids.Reverse();
}
else
r = true;
paramMap.Add("cids", string.Join(",",cids.ToArray()));
paramMap.Add("code", codeStr);
paramMap.Add(ParamDefine.rfid, shelfNum);
......
......@@ -485,7 +485,7 @@ namespace OnlineStore.DeviceLibrary
string msg = "";
foreach (AxisBean axis in axisArray)
{
bool result = axis.Open(false, out msg);
bool result = axis.Open(true, out msg);
if (!result || (!String.IsNullOrEmpty(msg)))
{
SetWarnMsg(Name + msg);
......
......@@ -626,6 +626,11 @@ namespace OnlineStore.DeviceLibrary
BOX_H03_SendOut_04,
BOX_H03_SendOut_05,
LO_20_UpdownUp_wait,
LO_15b_UpdownUp,
LI_25a_UpdownUp,
LO_15c_UpdownUp,
LO_20a_UpdownUp,
LO_20b_UpdownUp,
#endregion
}
......
......@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.LoadCSVLibrary</RootNamespace>
<AssemblyName>LoadCSVLibrary</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
......
......@@ -260,15 +260,11 @@ namespace OnlineStore.LoadCSVLibrary
///DI 0 15寸料盘宽度检测 X39
/// </summary>
public static string TrayCheck_15 = "TrayCheck_15";
/*
/// <summary>
///DI 0 卡爪到位确认 X39
/// </summary>
public static string Clamp_OnPosition = "Clamp_OnPosition";
/// <summary>
///DI 0 卡爪范围确认 X40
///DI 0 前门门禁信号 X40
/// </summary>
public static string Clamp_InRange = "Clamp_InRange";
public static string FrontDoor_Check = "FrontDoor_Check";
/*
/// <summary>
///DI 0 卡爪动作中 X41
/// </summary>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!