Commit f90ee823 张东亮

急停后复位rfid被关闭

1 个父辈 3142a26b
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
<?xml version="1.0"?>
<doc>
<assembly>
<name>Asa.RFID.ReadAll</name>
</assembly>
<members>
<member name="T:Asa.RFID.ReadAll">
<summary>
读取所有RFID
</summary>
</member>
<member name="M:Asa.RFID.ReadAll.#ctor(System.String)">
<summary>
读取所有RFID
</summary>
<param name="logName">日志名称</param>
</member>
<member name="P:Asa.RFID.ReadAll.Type">
<summary>
设备类型
</summary>
</member>
<member name="M:Asa.RFID.ReadAll.Start(System.Int32)">
<summary>
开始
</summary>
<param name="port">端口号</param>
</member>
<member name="M:Asa.RFID.ReadAll.Stop">
<summary>
停止
</summary>
</member>
<member name="M:Asa.RFID.ReadAll.Read(System.String,System.String)">
<summary>
读取
</summary>
<param name="ip">IP地址</param>
<param name="defaultID">没有找到时返回</param>
<returns></returns>
</member>
<member name="M:Asa.RFID.ReadAll.Read(System.String)">
<summary>
读取所有
</summary>
<param name="defaultID">没有数据时返回</param>
</member>
<member name="M:Asa.RFID.ReadAll.Clear(System.String,System.String)">
<summary>
清除缓存
</summary>
<param name="ip">IP地址</param>
<param name="defaultID">设置初始ID</param>
</member>
<member name="M:Asa.RFID.ReadAll.Clear(System.String)">
<summary>
清除所有缓存
</summary>
<param name="defaultID">设置初始ID</param>
</member>
<member name="T:Asa.RFID.DeviceType">
<summary>
RFID读卡器类型
</summary>
</member>
<member name="F:Asa.RFID.DeviceType.PuYue">
<summary>
普阅(新)
</summary>
</member>
<member name="F:Asa.RFID.DeviceType.HaoBin">
<summary>
浩斌(旧)
</summary>
</member>
</members>
</doc>
此文件类型无法预览
此文件类型无法预览
<?xml version="1.0"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
......@@ -78,4 +78,12 @@
</providers>
</roleManager>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.12.0" newVersion="2.0.12.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
......@@ -53,17 +53,18 @@
<ApplicationIcon>DfIcon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Client, Version=1.0.0.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\Client.dll</HintPath>
<Reference Include="Agv">
<HintPath>..\..\..\SO775-DUOStore\dll\Agv.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\..\dll\log4net.dll</HintPath>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
......@@ -106,6 +107,7 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.12" targetFramework="net472" />
</packages>
\ No newline at end of file
......@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.Common</RootNamespace>
<AssemblyName>Common</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
......@@ -33,9 +33,8 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\log4net.dll</HintPath>
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\..\packages\log4net.2.0.12\lib\net40\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\dll\Newtonsoft.Json.dll</HintPath>
......@@ -44,6 +43,7 @@
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
......@@ -66,6 +66,9 @@
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.12" targetFramework="net40" requireReinstallation="true" />
</packages>
\ No newline at end of file
......@@ -45,21 +45,18 @@
<Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
</Reference>
<Reference Include="Asa.RFID.HiStation">
<HintPath>..\..\dll\Asa.RFID.HiStation.dll</HintPath>
</Reference>
<Reference Include="Asa.RFID.IReadAll">
<HintPath>..\..\dll\Asa.RFID.IReadAll.dll</HintPath>
<Reference Include="Asa.RFID.ReadAll">
<HintPath>..\..\dll\Asa.RFID.ReadAll.dll</HintPath>
</Reference>
<Reference Include="HFReader9CSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\RFID\HFReader9CSharp.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\log4net.dll</HintPath>
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
......@@ -98,9 +95,11 @@
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="app.config" />
<None Include="LineConfig\LineConfig.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
......
......@@ -26,6 +26,6 @@ PRO,L1线入口节点名称,L1_In_AgvName,A2,,,,,,,
PRO,L1线出口节点名称,L1_Out_AgvName,A1,,,,,,,
PRO,L2线入口节点名称,L2_In_AgvName,A4,,,,,,,
PRO,L2线出口节点名称,L2_Out_AgvName,A3,,,,,,,
PRO,L1空料串线出口RFIDIP,L1_Out_RFIDIP,10.21.69.1,,,,,, ,
PRO,L2上料线出口RFIDIP,L2_Out_RFIDIP,10.21.69.46,,,,,, ,
PRO,L1空料串线出口RFIDIP,L1_Out_RFIDIP,10.21.69.46,,,,,, ,
PRO,L2上料线出口RFIDIP,L2_Out_RFIDIP,10.21.69.1,,,,,, ,
PRO,休眠秒数(秒),SleepSeconds,40,,,,,,,
......@@ -11,9 +11,9 @@ namespace OnlineStore.DeviceLibrary
{
public class RFIDManager
{
private static Asa.RFID.ReadAll readAll =new Asa.RFID.ReadAll ("TheRFID");
private static Asa.RFID.ReadAll readAll = new Asa.RFID.ReadAll("TheRFID");
private static bool IsOpen = false;
// private static ConcurrentDictionary<string, string> LastRfidMap = new ConcurrentDictionary<string, string>();
// private static ConcurrentDictionary<string, string> LastRfidMap = new ConcurrentDictionary<string, string>();
public static void Open()
{
if (IsOpen)
......@@ -27,9 +27,10 @@ namespace OnlineStore.DeviceLibrary
{
port = 13001;
}
//readAll.Received += ReadAll_Received;
// readAll.Log += ReadAll_Log;
//readAll.Received += ReadAll_Received;
// readAll.Log += ReadAll_Log;
LogUtil.info("RFID Server Open,port=" + port);
readAll.Type = Asa.RFID.DeviceType.PuYue;
readAll.Start(port);
IsOpen = true;
}
......@@ -39,7 +40,7 @@ namespace OnlineStore.DeviceLibrary
}
}
private static string lastStr = "";
private static void ReadAll_Log(string ip, string log)
{
string str = "RFID : [" + ip + "] " + log;
......@@ -57,13 +58,11 @@ namespace OnlineStore.DeviceLibrary
{
if (String.IsNullOrEmpty(ip).Equals(false))
{
string outValue = readAll.Read(ip);
string outValue = readAll.Read(ip, "000");
if (isClear)
{
readAll.Clear(ip);
readAll.Clear(ip, "000");
}
RFIDData data = new RFIDData(outValue);
return data;
}
......@@ -74,13 +73,28 @@ namespace OnlineStore.DeviceLibrary
}
return new RFIDData();
}
public static void ClearRFID(string ip)
{
try
{
if (String.IsNullOrEmpty(ip).Equals(false))
{
readAll.Clear(ip, "000");
}
}
catch (Exception ex)
{
LogUtil.error("ClearRFID[" + ip + "] 出错:" + ex.ToString());
}
}
public static void Close()
{
try
{
readAll.Stop();
IsOpen = false;
LogUtil.error("关闭RFID");
}
catch (Exception ex)
{
......
......@@ -2,7 +2,7 @@
using Agv;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
......@@ -11,14 +11,14 @@ using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
{
public partial class LineBean
{
{
public LineConfig Config;
public bool IsDebug = false;
public string Name = "";
public bool isInSuddenDown = false;
public LineMoveInfo MoveInfo = null;
public string Name = "";
public bool isInSuddenDown = false;
public LineMoveInfo MoveInfo = null;
public AlarmType alarmType = AlarmType.None;
public RunStatus runStatus = RunStatus.Wait;
......@@ -36,13 +36,13 @@ namespace OnlineStore.DeviceLibrary
mainTimer.Interval = 300;
mainTimer.AutoReset = true;
mainTimer.Enabled = false;
mainTimer.Elapsed +=timersTimer_Elapsed;
mainTimer.Elapsed += timersTimer_Elapsed;
//添加调试
IsDebug = ConfigAppSettings.GetIntValue(Setting_Init.IsInDebug).Equals(1);
MoveInfo = new LineMoveInfo();
Name = ConfigAppSettings.GetValue(Setting_Init.App_Title).ToUpper();
this.Config = config;
Name = ConfigAppSettings.GetValue(Setting_Init.App_Title).ToUpper();
this.Config = config;
IOManager.Init();
IOManager.instance.ConnectionIOList(Config.DIODeviceNameList);
......@@ -58,7 +58,7 @@ namespace OnlineStore.DeviceLibrary
}
AgvClient.Init();
Thread.Sleep(300);
Thread.Sleep(300);
//IOManager.IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.LOW);
}
......@@ -97,13 +97,13 @@ namespace OnlineStore.DeviceLibrary
{
isInSuddenDown = false;
alarmType = AlarmType.None;
SetWarnMsg("");
SetWarnMsg("");
//IOManager.IOMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.HIGH);
MoveInfo.NextMoveStep(MoveStep.VMI_H_StopUp);
IOManager.IOMove(IO_Type.AutoRun_HddLed, IO_VALUE.HIGH);
MoveInfo.NextMoveStep(MoveStep.VMI_H_StopUp);
LogUtil.info(Name + " 开始复位:所有阻挡上升,设置状态为None");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
IOManager.IOMove(IO_Type.L1_OutStopDown, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.L2_OutStopDown, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.L1_StopDown, IO_VALUE.LOW);
......@@ -123,14 +123,14 @@ namespace OnlineStore.DeviceLibrary
{
mainTimer.Enabled = false;
serverConnectTimer.Enabled = false;
runStatus = RunStatus.Reset;
runStatus = RunStatus.Reset;
MoveInfo.NewMove(LineMoveType.StoreReset);
ReturnHome();
}
else
{
SetWarnMsg("复位失败:急停未开");
}
SetWarnMsg("复位失败:急停未开");
}
}
/// <summary>
/// 复位处理
......@@ -162,7 +162,7 @@ namespace OnlineStore.DeviceLibrary
break;
default: break;
}
}
}
#endregion
......@@ -173,19 +173,19 @@ namespace OnlineStore.DeviceLibrary
public void StopRun()
{
WarnMsg = "";
RFIDManager.Close();
mainTimer.Enabled = false;
serverConnectTimer.Enabled = false;
StopMove();
runStatus = RunStatus.Wait;
StopMove();
runStatus = RunStatus.Wait;
IOManager.instance.CloseAllDO();
LogUtil.info(Name + ",停止运行");
}
public void Alarm(AlarmType alarmType)
{
if (this.alarmType.Equals(alarmType) && alarmType != AlarmType.SuddenStop )
{
if (this.alarmType.Equals(alarmType) && alarmType != AlarmType.SuddenStop)
{
return;
}
......@@ -198,7 +198,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(Name + "收到急停信号,停止运行 ");
MoveInfo.EndMove();
StopMove();
}
}
}
public void StopMove()
......@@ -208,10 +208,10 @@ namespace OnlineStore.DeviceLibrary
IOManager.IOMove(IO_Type.L1_StopDown, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.L1_OutStopDown, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.L2_StopDown, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.L2_OutStopDown, IO_VALUE.LOW);
IOManager.IOMove(IO_Type.L2_OutStopDown, IO_VALUE.LOW);
}
private bool InProcess = false;
private bool InProcess = false;
private Stopwatch stopwatch = new Stopwatch();
public bool MoveStop = false;
protected void timersTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
......@@ -226,8 +226,8 @@ namespace OnlineStore.DeviceLibrary
}
try
{
InProcess = true;
stopwatch.Restart();
InProcess = true;
stopwatch.Restart();
IoCheckProcess();
if (runStatus >= RunStatus.HomeMoving)
......@@ -242,9 +242,9 @@ namespace OnlineStore.DeviceLibrary
ResetProcess();
}
}
else if (runStatus.Equals(RunStatus.Runing))
else if (runStatus.Equals(RunStatus.Runing) && !alarmType.Equals(AlarmType.SuddenStop))
{
if(IsDebug)
if (IsDebug)
{
AgvClient.SetCancelState(true);
}
......@@ -281,7 +281,7 @@ namespace OnlineStore.DeviceLibrary
private DateTime ol1_lastSendShelfTime = DateTime.Now;
private DateTime ol2_lastSendShelfTime = DateTime.Now;
private int StopDownMS = 1500;
private int StopDownMS = 1000;
private DateTime il1_lastCallAgvTime = DateTime.Now.AddMinutes(-5);
private Stopwatch il1_outstopCheckWarch = new Stopwatch();
/// <summary>
......@@ -289,11 +289,11 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
private void EmptyLineTimerProcess()
{
TimeSpan span = DateTime.Now - ol1_lastSendShelfTime;
//如果出口无料架,持续1000以上,放开阻挡放出一个料架
//每次放料架时间间隔3秒
if (IOManager.IOValue(IO_Type.L1_StopCheck).Equals(IO_VALUE.HIGH)&&IOManager.IOValue(IO_Type.L1_OutCheck).Equals(IO_VALUE.LOW) && span.TotalSeconds > 3)
if (IOManager.IOValue(IO_Type.L1_StopCheck).Equals(IO_VALUE.HIGH) && IOManager.IOValue(IO_Type.L1_OutCheck).Equals(IO_VALUE.LOW) && span.TotalSeconds > 3)
{
//如果空料串线体出口无料架,放一个料架到出口
if (LineManager.checkWatch(ol1_noshelfWatch, 1000))
......@@ -306,8 +306,8 @@ namespace OnlineStore.DeviceLibrary
}
else if (span.TotalMilliseconds > StopDownMS)
{
ol1_noshelfWatch.Stop();
IOManager.CIOMove(IO_Type.L1_StopDown, IO_VALUE.LOW);
ol1_noshelfWatch.Stop();
IOManager.CIOMove(IO_Type.L1_StopDown, IO_VALUE.LOW);
}
TimeSpan span1 = DateTime.Now - il1_lastCallAgvTime;
......@@ -316,14 +316,14 @@ namespace OnlineStore.DeviceLibrary
//出口信号需要持续1秒钟
if (IOManager.IOValue(IO_Type.L1_OutCheck).Equals(IO_VALUE.HIGH) && span1.TotalSeconds > 60)
{
if (LastL1OutShelfId.Equals("000").Equals(false))
if (LastL1OutShelfId.StartsWith("0").Equals(false))
{
if (LineManager.checkWatch(il1_outstopCheckWarch, 1000))
{
il1_lastCallAgvTime = DateTime.Now;
LogUtil.info(" 空料串线体出口有料架" + LastL1OutShelfId + ",呼叫agv小车[" + Config.L1_Out_AgvName + "] [NeedLeave] ");
AgvClient.NeedLeave(Config.L1_Out_AgvName, LastL1OutShelfId);
AgvClient.NeedLeave(Config.L1_Out_AgvName, LastL1OutShelfId,Agv.ClientShelf.Empty);
}
}
}
......@@ -344,12 +344,13 @@ namespace OnlineStore.DeviceLibrary
if (IOManager.IOValue(IO_Type.L1_InCheck).Equals(IO_VALUE.LOW) && AgvClient.GetAction(Config.L1_In_AgvName).Equals(ClientAction.None))
{
AgvClient.NeedEnter(Config.L1_In_AgvName, "");
}else if(IOManager.IOValue(IO_Type.L1_InCheck).Equals(IO_VALUE.HIGH) && AgvClient.GetAction(Config.L1_In_AgvName).Equals(ClientAction.NeedEnter))
}
else if (IOManager.IOValue(IO_Type.L1_InCheck).Equals(IO_VALUE.HIGH) && AgvClient.GetAction(Config.L1_In_AgvName).Equals(ClientAction.NeedEnter))
{
AgvClient.SetToNone(Config.L1_In_AgvName, "");
}
//如果是出口无料架,NeedLeave状态,改为None
if ((IOManager.IOValue(IO_Type.L1_OutCheck).Equals(IO_VALUE.LOW) || LastL1OutShelfId.Equals("000")) &&
if ((IOManager.IOValue(IO_Type.L1_OutCheck).Equals(IO_VALUE.LOW) || LastL1OutShelfId.StartsWith("0")) &&
AgvClient.GetAction(Config.L1_Out_AgvName).Equals(ClientAction.NeedLeave))
{
il1_outstopCheckWarch.Stop();
......@@ -389,14 +390,14 @@ namespace OnlineStore.DeviceLibrary
//出口信号需要持续1秒钟
if (IOManager.IOValue(IO_Type.L2_OutCheck).Equals(IO_VALUE.HIGH) && span1.TotalSeconds > 60)
{
if (LastL2OutShelfId.Equals("000").Equals(false))
if (LastL2OutShelfId.StartsWith("0").Equals(false))
{
if (LineManager.checkWatch(il2_outstopCheckWarch, 1000))
{
il2_lastCallAgvTime = DateTime.Now;
LogUtil.info(" 上料线体出口有料架" + LastL2OutShelfId + ",呼叫agv小车[" + Config.L2_Out_AgvName + "] [NeedLeave] ");
AgvClient.NeedLeave(Config.L2_Out_AgvName, LastL2OutShelfId);
AgvClient.NeedLeave(Config.L2_Out_AgvName, LastL2OutShelfId,ClientShelf.Full);
}
}
}
......@@ -417,17 +418,17 @@ namespace OnlineStore.DeviceLibrary
{
AgvClient.NeedEnter(Config.L2_In_AgvName, "");
}
else if(IOManager.IOValue(IO_Type.L2_InCheck).Equals(IO_VALUE.HIGH) && AgvClient.GetAction(Config.L2_In_AgvName).Equals(ClientAction.NeedEnter))
else if (IOManager.IOValue(IO_Type.L2_InCheck).Equals(IO_VALUE.HIGH) && AgvClient.GetAction(Config.L2_In_AgvName).Equals(ClientAction.NeedEnter))
{
AgvClient.SetToNone(Config.L2_In_AgvName, "");
}
//如果是出口无料架,NeedLeave状态,改为None
if ((IOManager.IOValue(IO_Type.L2_OutCheck).Equals(IO_VALUE.LOW) || LastL2OutShelfId.Equals("000")) &&
if ((IOManager.IOValue(IO_Type.L2_OutCheck).Equals(IO_VALUE.LOW) || LastL2OutShelfId.StartsWith("0")) &&
AgvClient.GetAction(Config.L2_Out_AgvName).Equals(ClientAction.NeedLeave))
{
il2_outstopCheckWarch.Stop();
LogUtil.info(" 上料线体出口无料架/rfid未读到,更改[" + Config.L2_Out_AgvName + "] 状态[None] ");
AgvClient.SetToNone(Config.L2_Out_AgvName, "" );
AgvClient.SetToNone(Config.L2_Out_AgvName, "");
}
}
......@@ -623,7 +624,7 @@ namespace OnlineStore.DeviceLibrary
//}
}
}
private DateTime preIoTimerOutTime = DateTime.Now;
/// <summary>
/// io检测异常
......@@ -639,7 +640,7 @@ namespace OnlineStore.DeviceLibrary
if (runStatus < RunStatus.Runing || isInSuddenDown)
{
return;
}
}
if (alarmType.Equals(AlarmType.IoSingleTimeOut) && MoveInfo.IsInWait == false)
{
LogUtil.info(Name + "之前有IO超时报警,清理报警:" + WarnMsg);
......@@ -667,11 +668,28 @@ namespace OnlineStore.DeviceLibrary
isInProcess = true;
try
{
//LastL1OutShelfId = RFIDManager.ReadRFID(Config.L1_Out_RFIDIP, true).NumStr();
//LastL2OutShelfId = RFIDManager.ReadRFID(Config.L2_Out_RFIDIP, true).NumStr();
//LedProcess();
LastL2OutShelfId = RFIDManager.ReadRFID(Config.L1_Out_RFIDIP,true).NumStr();
LastL1OutShelfId = RFIDManager.ReadRFID(Config.L2_Out_RFIDIP,true).NumStr();
// if (IOManager.IOValue(IO_Type.L1_OutCheck).Equals(IO_VALUE.HIGH))
{
LastL1OutShelfId = RFIDManager.ReadRFID(Config.L1_Out_RFIDIP, true).NumStr();
}
//else
//{
// //RFIDManager.ClearRFID(Config.L1_Out_RFIDIP);
//}
// if (IOManager.IOValue(IO_Type.L2_OutCheck).Equals(IO_VALUE.HIGH))
{
LastL2OutShelfId = RFIDManager.ReadRFID(Config.L2_Out_RFIDIP, true).NumStr();
}
//else
//{
// //RFIDManager.ClearRFID(Config.L2_Out_RFIDIP);
//}
//bool result = SendVmiRfid(LastL2OutShelfId);
//if (result)
//{
......@@ -705,7 +723,7 @@ namespace OnlineStore.DeviceLibrary
return path;
}
private string http_server = ConfigAppSettings.GetValue(Setting_Init.http_server);
private string http_server = ConfigAppSettings.GetValue(Setting_Init.http_server);
private string api_communication = "/service/store/qisda/vmiRfid"; //流水线状态通信接口
private string lastLog = "";
public bool SendVmiRfid(string rfid)
......@@ -714,13 +732,13 @@ namespace OnlineStore.DeviceLibrary
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("rfid", rfid);
string addr = GetAddr(api_communication, paramMap ) ;
string addr = GetAddr(api_communication, paramMap);
string resultStr = HttpHelper.Post(addr, "");
string log = "vmiRfid 【" + addr + "】【" + resultStr + "】";
if (lastLog.Equals(log).Equals(false))
{
lastLog = log;
LogUtil.info(log);
LogUtil.info(log);
}
if (resultStr.Equals("move"))
{
......
......@@ -151,7 +151,10 @@ namespace OnlineStore.DeviceLibrary
}
private void SleepTimerProcess()
{
if (alarmType.Equals(AlarmType.SuddenStop))
{
return;
}
if (needCheckList.Count <= 0)
{
needCheckList.Add(IO_Type.L1_InCheck);
......@@ -163,6 +166,7 @@ namespace OnlineStore.DeviceLibrary
needCheckList.Add(IO_Type.L2_StopCheck);
needCheckList.Add(IO_Type.L2_OutCheck);
needCheckList.Add(IO_Type.L2_LoadSig);
needCheckList.Add(IO_Type.Pass_BTN);
needCheckList.Add(IO_Type.L2_StopDown);
}
bool agvBusy = false;
......
......@@ -60,14 +60,14 @@ namespace OnlineStore.DeviceLibrary
string appPath = Application.StartupPath;
string linefilePath = appPath + ConfigAppSettings.GetValue(Setting_Init.Line_Config);
LogUtil.info(LOGGER, " 开始加载VMI流水线配置:" + linefilePath);
LogUtil.info(LOGGER, " 开始加载流水线配置:" + linefilePath);
RobotConfig storeConfig = CSVConfigReader.LoadConfig(linefilePath);
Config = (LineConfig)storeConfig;
Line = new LineBean(Config);
LogUtil.info(LOGGER, "加载VMI流水线完成!");
LogUtil.info(LOGGER, "加载流水线完成!");
return Line;
}
......
......@@ -51,7 +51,28 @@ namespace OnlineStore.DeviceLibrary
private static void AgvClient_Received(Agv.Node node)
{
AgvClient_Ready(node.Name,node.RFID);
switch(node.Action)
{
//case ClientAction.ReadyLeave:
// AgvClient_ReadyLeave(node.Name,node.RFID);
// break;
//case ClientAction.ReadyEnter:
// AgvClient_ReadyEnter(node.Name,node.RFID);
// break;
//default:
// log.info(node.ToText());
// break;
case ClientAction.Ready:
AgvClient_Ready(node.Name, node.RFID);
break;
case ClientAction.None:
log.debug("收到心跳包");
break;
default:
log.info(node.ToText());
break;
}
log.debug(node.ToText());
}
/// <summary>
......@@ -63,7 +84,7 @@ namespace OnlineStore.DeviceLibrary
agvClient.CancelState = cancel;
}
public static void SetStatus(string id, string shelfId = "", Agv.ClientAction action = Agv.ClientAction.None, Agv.ClientLevel level = Agv.ClientLevel.Low)
public static void SetStatus(string id, string shelfId = "", Agv.ClientAction action = Agv.ClientAction.None, Agv.ClientLevel level = Agv.ClientLevel.Low, Agv.ClientShelf shelf = ClientShelf.None)
{
// ClientAction currA = GetAction(id);
if (actionMap.ContainsKey(id))
......@@ -75,7 +96,7 @@ namespace OnlineStore.DeviceLibrary
}
}
agvClient.SetStatus(id, "",shelfId, action, level);
agvClient.SetStatus(id, "",shelfId, action, level,shelf);
UpdateAction(id, action);
}
private static void AgvClient_Ready(string id, string rfid)
......@@ -84,55 +105,48 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(logName);
UpdateAction(id, Agv.ClientAction.Ready);
if (id.Equals(LineManager.Config.L1_In_AgvName))
if (id.Equals(LineManager.Config.L1_Out_AgvName))
{
LineManager.Line.UpdateSleep(false);
if (IOManager.IOValue(IO_Type.L1_InCheck).Equals(IO_VALUE.LOW))
string shefId = LineManager.Line.LastL1OutShelfId;
if (IOManager.IOValue(IO_Type.L1_OutCheck).Equals(IO_VALUE.HIGH))
{
SetStatus(id, shefId, ClientAction.MayLeave);
LineManager.Line.UpdateSleep(false);
LineManager.Line.StopIOMove(IO_Type.L1_OutStopDown, 2000);
LogUtil.info(logName + "下降 L1_OutStopDown , " + shefId);
Task.Factory.StartNew(delegate
{
SetStatus(id, "", ClientAction.MayEnter);
LogUtil.info(logName + " ,等待L1_InCheck");
try
{
WaitUtil.Wait(60000, delegate
{
return IOManager.IOValue(IO_Type.L1_InCheck).Equals(IO_VALUE.HIGH);
}, "等待L1_InCheck=HIGH");
}
catch (Exception ex)
{
LogUtil.error(logName + ":" + ex.ToString());
}
//两秒后改为离开状态
Thread.Sleep(3000);
LogUtil.info(logName + " ,调用 FinishEnter ");
SetStatus(id, "", ClientAction.FinishEnter);
Thread.Sleep(5000);
LogUtil.info(logName + " ,调用 FinishLeave " + shefId);
SetStatus(id, shefId, ClientAction.FinishLeave);
Thread.Sleep(5000);
LogUtil.info(logName + " ,处理结束 更新状态为None ");
SetStatus(id, "", ClientAction.None);
});
}
else
{
LogUtil.error(logName + " L1_InCheck 检测到有料架,AGV的料架无法进入");
LogUtil.error(logName + " L1_OutCheck 未检测到料架,无法将料架进入AGV");
SetStatus(id, "", ClientAction.None, ClientLevel.High);
}
}
else if (id.Equals(LineManager.Config.L1_Out_AgvName))
else if (id.Equals(LineManager.Config.L2_Out_AgvName))
{
string shefId = LineManager.Line.LastL1OutShelfId;
if (IOManager.IOValue(IO_Type.L1_OutCheck).Equals(IO_VALUE.HIGH))
string shefId = LineManager.Line.LastL2OutShelfId;
if (IOManager.IOValue(IO_Type.L2_OutCheck).Equals(IO_VALUE.HIGH))
{
SetStatus(id, shefId, ClientAction.MayLeave);
LineManager.Line.UpdateSleep(false);
LineManager.Line.StopIOMove(IO_Type.L1_OutStopDown, 1500);
LineManager.Line.StopIOMove(IO_Type.L2_OutStopDown, 2000);
//agvClient.MayLeave(id);
LogUtil.info(logName + "下降 L1_OutStopDown , " + shefId);
LogUtil.info(logName + "下降 L2_OutStopDown , " + shefId);
Task.Factory.StartNew(delegate
{
......@@ -149,25 +163,26 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error(logName + " L1_OutCheck 未检测到料架,无法将料架进入AGV");
LogUtil.error(logName + " L2_OutCheck 未检测到料架,无法将料架进入AGV");
SetStatus(id, "", ClientAction.None, ClientLevel.High);
}
}
else if (id.Equals(LineManager.Config.L2_In_AgvName))
if (id.Equals(LineManager.Config.L1_In_AgvName))
{
LineManager.Line.UpdateSleep(false);
if (IOManager.IOValue(IO_Type.L2_InCheck).Equals(IO_VALUE.LOW))
if (IOManager.IOValue(IO_Type.L1_InCheck).Equals(IO_VALUE.LOW))
{
Task.Factory.StartNew(delegate
{
SetStatus(id, "", ClientAction.MayEnter);
LogUtil.info(logName + " ,等待L2_InCheck");
LogUtil.info(logName + " ,等待L1_InCheck");
try
{
WaitUtil.Wait(60000, delegate
{
return IOManager.IOValue(IO_Type.L2_InCheck).Equals(IO_VALUE.HIGH);
}, "等待L2_InCheck=HIGH");
return IOManager.IOValue(IO_Type.L1_InCheck).Equals(IO_VALUE.HIGH);
}, "等待L1_InCheck=HIGH");
}
catch (Exception ex)
{
......@@ -187,44 +202,50 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error(logName + " L2_InCheck 检测到有料架,AGV的料架无法进入");
LogUtil.error(logName + " L1_InCheck 检测到有料架,AGV的料架无法进入");
SetStatus(id, "", ClientAction.None, ClientLevel.High);
}
}
else if (id.Equals(LineManager.Config.L2_Out_AgvName))
else if (id.Equals(LineManager.Config.L2_In_AgvName))
{
string shefId = LineManager.Line.LastL2OutShelfId;
if (IOManager.IOValue(IO_Type.L2_OutCheck).Equals(IO_VALUE.HIGH))
LineManager.Line.UpdateSleep(false);
if (IOManager.IOValue(IO_Type.L2_InCheck).Equals(IO_VALUE.LOW))
{
SetStatus(id, shefId, ClientAction.MayLeave);
LineManager.Line.UpdateSleep(false);
LineManager.Line.StopIOMove(IO_Type.L2_OutStopDown, 1500);
//agvClient.MayLeave(id);
LogUtil.info(logName + "下降 L2_OutStopDown , " + shefId);
Task.Factory.StartNew(delegate
{
SetStatus(id, "", ClientAction.MayEnter);
LogUtil.info(logName + " ,等待L2_InCheck");
try
{
WaitUtil.Wait(60000, delegate
{
return IOManager.IOValue(IO_Type.L2_InCheck).Equals(IO_VALUE.HIGH);
}, "等待L2_InCheck=HIGH");
}
catch (Exception ex)
{
LogUtil.error(logName + ":" + ex.ToString());
}
//两秒后改为离开状态
Thread.Sleep(5000);
LogUtil.info(logName + " ,调用 FinishLeave " + shefId);
SetStatus(id, shefId, ClientAction.FinishLeave);
Thread.Sleep(3000);
LogUtil.info(logName + " ,调用 FinishEnter ");
SetStatus(id, "", ClientAction.FinishEnter);
Thread.Sleep(5000);
LogUtil.info(logName + " ,处理结束 更新状态为None ");
SetStatus(id, "", ClientAction.None);
});
}
else
{
LogUtil.error(logName + " L2_OutCheck 未检测到料架,无法将料架进入AGV");
LogUtil.error(logName + " L2_InCheck 检测到有料架,AGV的料架无法进入");
SetStatus(id, "", ClientAction.None, ClientLevel.High);
}
}
}
}
public static bool SetToNone(string id, string shelfId = "")
{
Agv.ClientAction currA = GetAction(id);
......@@ -245,12 +266,12 @@ namespace OnlineStore.DeviceLibrary
}
return false;
}
public static bool NeedLeave(string id, string shelfId)
public static bool NeedLeave(string id, string shelfId,ClientShelf shelf = ClientShelf.None)
{
Agv.ClientAction currA = GetAction(id);
if (currA.Equals(Agv.ClientAction.None) || currA.Equals(Agv.ClientAction.NeedLeave) || currA.Equals(Agv.ClientAction.NeedEnter))
{
SetStatus(id, shelfId, Agv.ClientAction.NeedLeave);
SetStatus(id, shelfId, Agv.ClientAction.NeedLeave,ClientLevel.None,shelf);
return true;
}
return false;
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.12.0" newVersion="2.0.12.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.12" targetFramework="net472" />
</packages>
\ No newline at end of file
......@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.LoadCSVLibrary</RootNamespace>
<AssemblyName>LoadCSVLibrary</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
......@@ -33,12 +33,13 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\log4net.dll</HintPath>
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\..\packages\log4net.2.0.12\lib\net40\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
......@@ -63,6 +64,9 @@
<Name>Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.12" targetFramework="net40" requireReinstallation="true" />
</packages>
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!