Commit 8474f71b 几米阳光

出库失败时缓存

1 个父辈 39ce94c7
...@@ -45,6 +45,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -45,6 +45,7 @@ namespace OnlineStore.DeviceLibrary
Init(); Init();
serverConnectTimer.Elapsed += server_connect_timer_Tick; serverConnectTimer.Elapsed += server_connect_timer_Tick;
IoCheckTimer.Elapsed += IoCheckTimer_Elapsed; IoCheckTimer.Elapsed += IoCheckTimer_Elapsed;
ledCheckTimer.Elapsed += LedCheckTimer_Elapsed;
IsDebug = (config.IsInDebug == 1); IsDebug = (config.IsInDebug == 1);
...@@ -88,7 +89,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -88,7 +89,18 @@ namespace OnlineStore.DeviceLibrary
}); });
} }
} }
private static bool ledInProcess = false;
private void LedCheckTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (ledInProcess)
{
return;
}
ledInProcess = true;
LedProcess();
ledInProcess = false;
}
private void IoCheckTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) private void IoCheckTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{ {
//判断急停 //判断急停
...@@ -98,17 +110,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -98,17 +110,17 @@ namespace OnlineStore.DeviceLibrary
{ {
if (isInSuddenDown.Equals(false)) if (isInSuddenDown.Equals(false))
{ {
LogUtil.error(LOGGER, StoreName + "收到急停信号,等待200后再次判断"); //LogUtil.error(LOGGER, StoreName + "收到急停信号,等待200后再次判断");
Thread.Sleep(200); //Thread.Sleep(200);
if (KND.IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW)) //if (KND.IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
{ //{
isInSuddenDown = true; isInSuddenDown = true;
LogUtil.error(LOGGER, StoreName + "收到急停信号,报警急停"); LogUtil.error(LOGGER, StoreName + "收到急停信号,报警急停");
WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.inSuddenStop, "收到急停信号,报警急停"); WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.inSuddenStop, "收到急停信号,报警急停");
//报警时会关闭所有轴 //报警时会关闭所有轴
Alarm(StoreAlarmType.SuddenStop, "1", WarnMsg, StoreMoveType.None); Alarm(StoreAlarmType.SuddenStop, "1", WarnMsg, StoreMoveType.None);
} //}
} }
} }
else else
...@@ -225,6 +237,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -225,6 +237,7 @@ namespace OnlineStore.DeviceLibrary
HumitureController.Init(Config.Humiture_Port); HumitureController.Init(Config.Humiture_Port);
ReturnHome(); ReturnHome();
mainTimer.Enabled = true; mainTimer.Enabled = true;
ledCheckTimer.Enabled = true;
IoCheckTimer.Enabled = true; IoCheckTimer.Enabled = true;
serverConnectTimer.Enabled = true; serverConnectTimer.Enabled = true;
return true; return true;
...@@ -728,6 +741,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -728,6 +741,7 @@ namespace OnlineStore.DeviceLibrary
autoNext = false; autoNext = false;
IoCheckTimer.Enabled = false; IoCheckTimer.Enabled = false;
serverConnectTimer.Enabled = false; serverConnectTimer.Enabled = false;
ledCheckTimer.Enabled = false;
StoreMove.EndMove(); StoreMove.EndMove();
StopMove(true); StopMove(true);
...@@ -748,7 +762,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -748,7 +762,7 @@ namespace OnlineStore.DeviceLibrary
{ {
SaveAlarmInfo(alarmType, alarmDetial, alarmMsg, storeMoveType); SaveAlarmInfo(alarmType, alarmDetial, alarmMsg, storeMoveType);
autoNext = false; autoNext = false;
KND.IOMove(IO_Type.Alarm_HddLed, IO_VALUE.HIGH);
if (this.alarmType.Equals(alarmType) && alarmType != StoreAlarmType.SuddenStop && alarmType != StoreAlarmType.NoAirCheck) if (this.alarmType.Equals(alarmType) && alarmType != StoreAlarmType.SuddenStop && alarmType != StoreAlarmType.NoAirCheck)
{ {
return; return;
...@@ -1084,7 +1098,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1084,7 +1098,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(LOGGER, "IOTimeOutProcess出错:" + ex.ToString()); LogUtil.error(LOGGER, "IOTimeOutProcess出错:" + ex.ToString());
} }
} }
//private DateTime preProTime = DateTime.Now;
/// <summary> /// <summary>
/// 超过配置次数时需要复位 /// 超过配置次数时需要复位
/// </summary> /// </summary>
...@@ -1092,6 +1106,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -1092,6 +1106,12 @@ namespace OnlineStore.DeviceLibrary
{ {
try try
{ {
//TimeSpan span = DateTime.Now - preProTime;
//if (span.TotalSeconds < 1)
//{
// return;
//}
//preProTime = DateTime.Now;
if (CurrInOutACount >= this.Config.Box_ResetACount) if (CurrInOutACount >= this.Config.Box_ResetACount)
{ {
if (storeRunStatus < StoreRunStatus.Runing || StoreMove.MoveType == StoreMoveType.InStore || StoreMove.MoveType == StoreMoveType.OutStore) if (storeRunStatus < StoreRunStatus.Runing || StoreMove.MoveType == StoreMoveType.InStore || StoreMove.MoveType == StoreMoveType.OutStore)
...@@ -1394,6 +1414,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1394,6 +1414,7 @@ namespace OnlineStore.DeviceLibrary
} }
#endregion #endregion
#region 与服务器通信定时器,每1秒向服务器通知一次状态,同时执行出库操作 #region 与服务器通信定时器,每1秒向服务器通知一次状态,同时执行出库操作
public string CodeOrInoutMsg = ""; public string CodeOrInoutMsg = "";
private bool isInProcess = false; private bool isInProcess = false;
...@@ -1418,7 +1439,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1418,7 +1439,7 @@ namespace OnlineStore.DeviceLibrary
//温湿度暂时注释 //温湿度暂时注释
HumitureController.QueryData(); HumitureController.QueryData();
HumidityProcess(); HumidityProcess();
LedProcess(); // LedProcess();
isInProcess = false; isInProcess = false;
} }
...@@ -1701,13 +1722,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -1701,13 +1722,21 @@ namespace OnlineStore.DeviceLibrary
} }
else else
{ {
FixtureCodeInfo currInOutFixture = new FixtureCodeInfo(0, "", posId, plateW, plateH);
if (CanStarInOut()) if (CanStarInOut())
{ {
StartOutStoreMove(new InOutStoreParam("", posId,plateH,plateW), !isSingleOut); bool result = StartOutStoreMove(new InOutStoreParam("", posId, plateH, plateW), !isSingleOut);
if (!result)
{
LogUtil.info(LOGGER, StoreName + " 执行出库【" + currInOutFixture.ToStr() + "】失败,加入等待队列");
AddWaitOutInfo(currInOutFixture);
}
} }
else else
{ {
LogUtil.error(LOGGER, "收到服务器出库命令:出库【" + posId + "】失败,当前在忙碌中"); LogUtil.info(LOGGER, StoreName + " 执行出库【" + currInOutFixture.ToStr() + "】失败,当前在忙碌中,加入等待队列");
AddWaitOutInfo(currInOutFixture);
} }
} }
}catch(Exception ex) }catch(Exception ex)
......
...@@ -82,7 +82,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -82,7 +82,7 @@ namespace OnlineStore.DeviceLibrary
param.MoveP.BatchAxis_DownValue = AutomaticBaiting.AxisChangeValue * param.PlateH + Config.BatchAxis_OutDownPosition; param.MoveP.BatchAxis_DownValue = AutomaticBaiting.AxisChangeValue * param.PlateH + Config.BatchAxis_OutDownPosition;
//LogUtil.debug("【" + param.PositionNum + "】高度【" + param.PlateH + "】批量上下料轴需要下降【" + param.MoveP.BatchAxis_DownValue + "】"); //LogUtil.debug("【" + param.PositionNum + "】高度【" + param.PlateH + "】批量上下料轴需要下降【" + param.MoveP.BatchAxis_DownValue + "】");
param.MoveP.UpDown_P1 = Config.GetUpDownP1(param.PlateH); param.MoveP.UpDown_P1 = Config.GetUpDownP1(param.PlateH);
LogUtil.info("【" + param.PositionNum + "】高【" + param.PlateH + "】升降轴P1【" + param.MoveP.UpDown_P1 + "】压紧轴P2【" + param.MoveP.ComPress_P2 + "】批量上下料轴需要下降【" + param.MoveP.BatchAxis_DownValue + "】"); LogUtil.debug("【" + param.PositionNum + "】高【" + param.PlateH + "】升降轴P1【" + param.MoveP.UpDown_P1 + "】压紧轴P2【" + param.MoveP.ComPress_P2 + "】批量上下料轴需要下降【" + param.MoveP.BatchAxis_DownValue + "】");
return true; return true;
} }
...@@ -629,6 +629,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -629,6 +629,7 @@ namespace OnlineStore.DeviceLibrary
OutStoreLog("出库:SO_01 定位气缸下降"); OutStoreLog("出库:SO_01 定位气缸下降");
LocationDownAndWait(); LocationDownAndWait();
} }
CodeOrInoutMsg = "";
return true; return true;
} }
else else
...@@ -914,6 +915,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -914,6 +915,7 @@ namespace OnlineStore.DeviceLibrary
public void UpdateInOutMsg(string Msg) public void UpdateInOutMsg(string Msg)
{ {
CodeOrInoutMsg = Msg; CodeOrInoutMsg = Msg;
//WarnMsg = Msg;
LogUtil.error(Msg); LogUtil.error(Msg);
} }
public bool InOutAxisCanMove() public bool InOutAxisCanMove()
......
...@@ -73,6 +73,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -73,6 +73,7 @@ namespace OnlineStore.DeviceLibrary
protected System.Timers.Timer mainTimer; protected System.Timers.Timer mainTimer;
protected System.Timers.Timer serverConnectTimer = new System.Timers.Timer(); protected System.Timers.Timer serverConnectTimer = new System.Timers.Timer();
protected System.Timers.Timer IoCheckTimer = new System.Timers.Timer(); protected System.Timers.Timer IoCheckTimer = new System.Timers.Timer();
protected System.Timers.Timer ledCheckTimer = new System.Timers.Timer();
public AC_Store() public AC_Store()
{ {
} }
...@@ -94,9 +95,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -94,9 +95,14 @@ namespace OnlineStore.DeviceLibrary
serverConnectTimer.Enabled = false; serverConnectTimer.Enabled = false;
//serverConnectTimer.Elapsed += server_connect_timer_Tick; //serverConnectTimer.Elapsed += server_connect_timer_Tick;
IoCheckTimer = new System.Timers.Timer(); IoCheckTimer = new System.Timers.Timer();
IoCheckTimer.Interval = 300; IoCheckTimer.Interval = 200;
IoCheckTimer.AutoReset = true; IoCheckTimer.AutoReset = true;
IoCheckTimer.Enabled = false; IoCheckTimer.Enabled = false;
ledCheckTimer = new System.Timers.Timer();
ledCheckTimer.Interval = 500;
ledCheckTimer.AutoReset = true;
ledCheckTimer.Enabled = false;
//IoCheckTimer.Elapsed += IoCheckTimer_Elapsed; //IoCheckTimer.Elapsed += IoCheckTimer_Elapsed;
} }
......
...@@ -20,14 +20,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -20,14 +20,15 @@ namespace OnlineStore.DeviceLibrary
this.PosId = posId; this.PosId = posId;
SetSize(); SetSize();
} }
//public FixtureCodeInfo(int trayCode, string wareNum, string posId,int platew, int plateh)
//{ public FixtureCodeInfo(int trayCode, string wareNum, string posId, int platew, int plateh)
// this.TrayCode = trayCode; {
// this.WareNum = wareNum; this.TrayCode = trayCode;
// this.PosId = posId; this.WareNum = wareNum;
// this.plateW = platew; this.PosId = posId;
// this.plateH = plateh; this.plateW = platew;
//} this.plateH = plateh;
}
public void SetSize() public void SetSize()
{ {
AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(PosId); AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(PosId);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!