Commit 16cf7bbc 几米阳光

出入库流程优化

1 个父辈 f28a4149
......@@ -1720,21 +1720,24 @@ namespace OnlineStore.AutoInOutStore
string poText = cmbPosition.Text;
ConfigAppSettings.SaveValue(Setting_Init.DebugPosId, poText);
store.autoMsg = "自动入库:" + poText;
string msg = AutomaticBaiting.doStartBatchIn();
if (msg.Equals(""))
{
store.autoNext = true;
btnStart.Text = StopAuto;
LogUtil.info(LOGGER, store.StoreName + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!");
}
else
{
MessageBox.Show(msg);
store.autoNext = false;
btnStart.Text = StartAuto;
LogUtil.info(LOGGER, store.StoreName + "自动出入库失败【"+msg+"】,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!");
}
store.autoMsg = "自动出入库:" + poText;
store.autoNext = true;
LogUtil.info(LOGGER, store.StoreName + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + "");
btnStart.Text = StopAuto;
//string msg = AutomaticBaiting.doStartBatchIn();
//if (msg.Equals(""))
//{
// store.autoNext = true;
// btnStart.Text = StopAuto;
// LogUtil.info(LOGGER, store.StoreName + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!");
//}
//else
//{
// MessageBox.Show(msg);
// store.autoNext = false;
// btnStart.Text = StartAuto;
// LogUtil.info(LOGGER, store.StoreName + "自动出入库失败【"+msg+"】,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!");
//}
DebugStatus(false);
}
}
......
......@@ -250,6 +250,6 @@ namespace OnlineStore.Common
/// </summary>
public static string batchAxis = "device_batchAxis";
public static string posName = "posName";
public static string inPos = "inPos";
}
}
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading;
namespace OnlineStore.DeviceLibrary
{
......@@ -390,6 +391,21 @@ namespace OnlineStore.DeviceLibrary
//Thread.Sleep(SleepMSendons);
OpenAndCloseSTB(portName, slvAddr);
}
public static bool isInPosition(ConfigMoveAxis Axis, int PPosition)
{
int outCount = ACServerManager.GetActualtPosition(Axis.DeviceName, Axis.GetAxisValue());
int errorCount = Math.Abs(outCount - PPosition);
if (errorCount <= Axis.CanErrorCountMin)
{
return true;
}
else
{
return false;
}
}
public static void AbsMove(string portName, int slvAddr, int targetPosition, int targetSpeed)
{
//先更新速度
......
......@@ -341,7 +341,19 @@ namespace OnlineStore.DeviceLibrary
byte[] reviceData = SendData(slvAddr, ShuoKeCMD.GetAbsPosition, 0x00, 0, 9);
return DataToPosition(reviceData);
}
public static bool IsInPosition(int slvAddr,int position)
{
int outCount = GetABSPosition(slvAddr);
int errorCount = Math.Abs(outCount - position);
if (errorCount <= 100)
{
return true;
}
else
{
return false;
}
}
// <param name="homeType">0=反方向,1=正方向</param>
public static void HomeMove(int slvAddr, byte homeType)
{
......
......@@ -1348,12 +1348,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
/// <returns></returns>
public bool CanStarInOut()
{
//if (isInSuddenDown || isNoAirCheck ||
// (!storeRunStatus.Equals(StoreRunStatus.Runing))
// || storeStatus.Equals(StoreStatus.InStoreExecute) || storeStatus.Equals(StoreStatus.OutStoreExecute)
// || storeStatus.Equals(StoreStatus.InStoreEnd) || storeStatus.Equals(StoreStatus.OutStoreBoxEnd))
{
if ((isInSuddenDown.Equals(false)) && (isNoAirCheck.Equals(false)) && (StoreMove.MoveType.Equals(StoreMoveType.None))
&& (storeRunStatus.Equals(StoreRunStatus.Runing)))
{
......
......@@ -94,7 +94,7 @@ namespace OnlineStore.DeviceLibrary
#region 出入库结果验证
private void InOutBackToP1(int InOut_P1)
private bool InOutBackToP1(int InOut_P1)
{
//判断是否在P1,如果是,不需要运行
int outCount = ACServerManager.GetActualtPosition(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue());
......@@ -102,10 +102,12 @@ namespace OnlineStore.DeviceLibrary
if (errorCount <= Config.InOut_Axis.CanErrorCountMin)
{
LogUtil.debug("进出轴当前位置:" + outCount + ",已经在P1,不需要再回P1");
return false;
}
else
{
ACAxisMove(Config.InOut_Axis, InOut_P1, Config.InOutAxis_P1_Speed);
return true;
}
}
......@@ -335,19 +337,49 @@ namespace OnlineStore.DeviceLibrary
return false;
}
}
private void SI_03_AxisToP1(LineMoveP moveP)
{
InStoreLog("入库:SI_03 所有轴回到待机点,轴2、轴1 动作到P1, 轴4动作至P3,等待吸盘处于上升位置");
StoreMove.NextMoveStep(StoreMoveStep.SI_03_ReturnHome);
bool needMove = false;
if (!ShuoKeControls.IsInPosition(Config.CompressAxis_Slv, moveP.ComPress_P3))
{
needMove = true;
ComMoveToPosition(moveP.ComPress_P3);
}
if (!ACServerManager.isInPosition(Config.UpDown_Axis, moveP.UpDown_P1))
{
needMove = true;
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
}
if (!ACServerManager.isInPosition(Config.Middle_Axis, moveP.Middle_P1))
{
needMove = true;
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
}
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Up, IO_VALUE.HIGH));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Down, IO_VALUE.LOW));
//如果不需要回待机点,直接到下一个步骤
if (!needMove && IOManager.IOValue(IO_Type.SuckingDisc_Down).Equals(IO_VALUE.LOW) && IOManager.IOValue(IO_Type.SuckingDisc_Up).Equals(IO_VALUE.HIGH))
{
SI_04_DeviceToDoor();
}
}
private void SI_02_Move(LineMoveP moveP)
{
InStoreLog("入库:SI_02_ 进出轴(叉子)动作至P1");
StoreMove.NextMoveStep(StoreMoveStep.SI_02_InOutAxisHome);
InOutBackToP1(moveP.InOut_P1);
StoreMove.NextMoveStep(StoreMoveStep.SI_02_InOutAxisHome);
bool result = InOutBackToP1(moveP.InOut_P1);
if (!result)
{
SI_03_AxisToP1(moveP);
}
}
private void SI_04_DeviceToDoor()
{
InStoreLog("入库:SI_04 叉子进入入料口,进出轴至P2 ");
StoreMove.NextMoveStep(StoreMoveStep.SI_04_DeviceToDoor);
ACAxisMove(Config.InOut_Axis, StoreMove.MoveParam.MoveP.InOut_P2, Config.InOutAxis_P2_Speed);
ACAxisMove(Config.InOut_Axis, StoreMove.MoveParam.MoveP.InOut_P2, Config.InOutAxis_P2_Speed);
}
protected override void InStoreProcess()
{
......@@ -367,16 +399,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_02_InOutAxisHome)
{
InStoreLog("入库:SI_03 所有轴回到待机点,轴2、轴1 动作到P1, 轴4动作至P3,等待吸盘处于上升位置");
StoreMove.NextMoveStep(StoreMoveStep.SI_03_ReturnHome);
ComMoveToPosition(moveP.ComPress_P3);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
//此处需要等待吸盘在上升位置
IOManager.IOMove(IO_Type.SuckingDisc_Up, IO_VALUE.HIGH);
IOManager.IOMove(IO_Type.SuckingDisc_Down, IO_VALUE.LOW);
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Up, IO_VALUE.HIGH));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Down, IO_VALUE.LOW));
SI_03_AxisToP1(moveP);
}
else if (StoreMove.MoveStep == StoreMoveStep.SI_03_ReturnHome)
{
......@@ -588,21 +611,18 @@ namespace OnlineStore.DeviceLibrary
{
if (!LoadParamPosition(param, IsBatchWork))
{
UpdateInOutMsg(logMsg + "失败,找不到库位信息");
//LogUtil.error(LOGGER, StoreName + logMsg + " 出错,找不到库位信息");
UpdateInOutMsg(logMsg + "失败,找不到库位信息");
return false;
}
if (IOManager.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH))
{
UpdateInOutMsg(logMsg + "失败,叉子料盘检测有料");
//LogUtil.error(LOGGER, StoreName + logMsg + " 出错,叉子料盘检测有料");
UpdateInOutMsg(logMsg + "失败,叉子料盘检测有料");
return false;
}
//若自动上料机构正在入库中,不可以出库
if (!AutomaticBaiting.AutoBaitingStatus.Equals(StoreRunStatus.Runing))
{
UpdateInOutMsg(logMsg + "失败,批量上下料机构不在空闲中");
//LogUtil.error(LOGGER, StoreName + logMsg + " 出错,批量上下料机构不在空闲中");
UpdateInOutMsg(logMsg + "失败,批量上下料机构不在空闲中");
return false;
}
//判断批量上下料机构是否已经满
......@@ -611,8 +631,7 @@ namespace OnlineStore.DeviceLibrary
int currBatchValue = ACServerManager.GetActualtPosition(Config.Batch_Axis.DeviceName, Config.Batch_Axis.GetAxisValue());
if (currBatchValue - param.MoveP.BatchAxis_DownValue < 1000)
{
UpdateInOutMsg(logMsg + "失败,批量上下料机构已满,请先拿出料盘");
//LogUtil.error(LOGGER, StoreName + logMsg + " 出错,批量上下料机构已满,请先拿出料盘");
UpdateInOutMsg(logMsg + "失败,批量上下料机构已满,请先拿出料盘");
return false;
}
}
......@@ -620,8 +639,7 @@ namespace OnlineStore.DeviceLibrary
if (AutomaticBaiting.BatchOutStoreHeight+ height > Config.BatchAxis_MaxHeight)
{
LogUtil.error(LOGGER, StoreName + logMsg + " 出错,当前高【"+ AutomaticBaiting.BatchOutStoreHeight + "】出库料盘高【"+ height + "】,最大高【"+ Config.BatchAxis_MaxHeight + "】");
UpdateInOutMsg(logMsg + "失败,批量上下料机构已满,请先拿出料盘");
//LogUtil.error(LOGGER, StoreName + logMsg + " 出错,批量上下料机构已满,请先拿出料盘");
UpdateInOutMsg(logMsg + "失败,批量上下料机构已满,请先拿出料盘");
return false;
}
......@@ -674,9 +692,9 @@ namespace OnlineStore.DeviceLibrary
{
//上下料机构下降的距离=料盘最低高度+默认的高度
int outDownPosition = StoreMove.MoveParam.MoveP.BatchAxis_DownValue;
int targetValue = GetBatchTargetValue(outDownPosition);
if (targetValue >= 1000 )
if (targetValue >= 1000)
{
StoreMove.TimeOutSeconds = 120;
ACAxisMove(Config.Batch_Axis, targetValue, Config.BatchAxis_P1_Speed);
......@@ -685,7 +703,7 @@ namespace OnlineStore.DeviceLibrary
else
{
AutomaticBaiting.BatchOutStoreCount++;
AutomaticBaiting.BatchOutStoreHeight =1000;
AutomaticBaiting.BatchOutStoreHeight = 1000;
OutStoreLog("出库:SO_03批量上下料轴需要下降【" + outDownPosition + "】目标【" + targetValue + "】 ,请检查料盘是否已满");
//停止出库
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
......@@ -698,10 +716,11 @@ namespace OnlineStore.DeviceLibrary
}
}
OutStoreLog("出库:SO_03 走到库位,压紧轴至P3(压紧前点) ,旋转轴至P2(库位点),升降轴至P5(库位出库前点)");
ComMoveToPosition(moveP.ComPress_P3);
ComMoveToPosition(moveP.ComPress_P3);
ACAxisMove(Config.Middle_Axis, StoreMove.MoveParam.MoveP.Middle_P2, Config.MiddleAxis_P2_Speed);
ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_P5, Config.UpDownAxis_P5_Speed);
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_03_ToBagPosition)
{
......@@ -713,7 +732,7 @@ namespace OnlineStore.DeviceLibrary
{
OutStoreLog("出库:SO_05 拿起物品,升降轴至P6(库位出料缓冲点),压紧轴至P2(压紧点) ");
StoreMove.NextMoveStep(StoreMoveStep.SO_05_BagWareToDevice);
ComMoveToPosition(moveP.ComPress_P2,true);
ComMoveToPosition(moveP.ComPress_P2, true);
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P6, Config.UpDownAxis_P6_Speed);
}
else if (StoreMove.MoveStep == StoreMoveStep.SO_05_BagWareToDevice)
......@@ -777,7 +796,7 @@ namespace OnlineStore.DeviceLibrary
{
StoreMove.NextMoveStep(StoreMoveStep.SO_11_PutTray);
OutStoreLog("出库:SO_11_PutTray 放下料盘,升降轴到P8(出库低点),压紧轴至P3(压紧前点)");
ComMoveToPosition(StoreMove.MoveParam.MoveP.ComPress_P3,true);
ComMoveToPosition(StoreMove.MoveParam.MoveP.ComPress_P3, true);
ACAxisMove(Config.UpDown_Axis, StoreMove.MoveParam.MoveP.UpDown_OutLow_P8, Config.UpDownAxis_P8_Speed);
AutomaticBaiting.BatchOutStoreHeight += StoreMove.MoveParam.PlateH;
AutomaticBaiting.BatchOutStoreCount++;
......@@ -816,7 +835,7 @@ namespace OnlineStore.DeviceLibrary
{
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
storeStatus = StoreStatus.StoreOnline;
LogUtil.info(LOGGER, "【" + posId + "】出库结束,耗时【" + FormUtil.GetSpanStr(InOutWatch.Elapsed) + "】累积出库: " + AutomaticBaiting.BatchOutStoreCount + "盘共" + AutomaticBaiting.BatchOutStoreHeight + "mm");
LogUtil.info(LOGGER, "【" + posId + "】出库结束,耗时【" + FormUtil.GetSpanStr(InOutWatch.Elapsed) + "】累积出库: " + AutomaticBaiting.BatchOutStoreCount + "盘共" + AutomaticBaiting.BatchOutStoreHeight + "mm");
StoreMove.EndMove();
storeRunStatus = StoreRunStatus.Runing;
InOutEndProcess(StoreMoveType.OutStore);
......
......@@ -333,8 +333,9 @@ namespace OnlineStore.DeviceLibrary
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I06_SuckingDisc_Up);
LogUtil.info(Name + "入料: 吸盘上升");
CylinderMove(IO_Type.SuckingDisc_Up, IO_Type.SuckingDisc_Down, true);
// StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Down, IO_VALUE.LOW));
CylinderMove(IO_Type.SuckingDisc_Up, IO_Type.SuckingDisc_Down, false );
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Down, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(1500));
}
else if (SuckingDisc_WorkCount < 3)
......
......@@ -232,19 +232,15 @@ namespace OnlineStore.DeviceLibrary
LogUtil.debug(wait.ToStr() + " 检测到【" + wait.IoType + "】信号,可以停止运动");
result = true;
}
else if (IOManager.IOValue(IO_Type.BatchAxis_Limit).Equals(IO_VALUE.HIGH))
//else if (ACServerManager.GetLimitPositiveSingle(wait.AxisInfo).Equals(1))
else if (IOManager.IOValue(IO_Type.BatchAxis_Limit).Equals(IO_VALUE.HIGH))
{
LogUtil.debug(wait.ToStr() + " 检测到正极限信号,可以停止运动");
//ACServerManager.SuddenStop(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
//Thread.Sleep(50);
LogUtil.debug(wait.ToStr() + " 检测到正极限信号,可以停止运动");
result = true;
}
if (result)
{
//AutoAxisIsMove = 0;
{
LogUtil.debug(wait.ToStr() + " 停止运动");
ACServerManager.SuddenStop(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
ACServerManager.SuddenStop(wait.AxisInfo);
}
return result;
}
......@@ -389,7 +385,7 @@ namespace OnlineStore.DeviceLibrary
string autoposId = StoreManager.Store.GetAutoPosid(true);
if (StoreManager.Store.autoNext && (!String.IsNullOrEmpty(autoposId)))
{
operation.data.Add(ParamDefine.posName, autoposId);
operation.data.Add(ParamDefine.inPos, autoposId);
LogUtil.info("添加自动入库库位号:"+autoposId);
}
string server = ConfigAppSettings.GetValue(Setting_Init.http_server);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!