Commit 8474f71b 几米阳光

出库失败时缓存

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