Commit 7177613c LN

出库重复任务过滤。条码数量改为可配置。

1 个父辈 4fcb71c2
......@@ -60,6 +60,7 @@
<add key="Tool_P6_Offset" value="6000" />
<add key="Tool_TargetSpeed" value="20" />
<add key="Tool_TargetPosition" value="6000" />
<add key ="CodeCount" value ="1"/>
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
......@@ -114,6 +114,7 @@ namespace OnlineStore.Common
public static string Tool_TargetSpeed = "Tool_TargetSpeed";
public static string Tool_TargetPosition = "Tool_TargetPosition";
public static string CodeCount = "CodeCount";
}
}
......@@ -133,8 +133,12 @@ namespace OnlineStore.DeviceLibrary
[HandleProcessCorruptedStateExceptions]
public static List<string> CameraScan( )
{
int codeCount = 1;
{
int codeCount = ConfigAppSettings.GetIntValue(Setting_Init.CodeCount);
if (codeCount <= 0)
{
codeCount = 1;
}
List<string> codeList = new List<string>();
if (cameraNameList == null || cameraNameList.Count <= 0)
{
......
......@@ -2019,6 +2019,24 @@ namespace OnlineStore.DeviceLibrary
else
{
FixtureCodeInfo currInOutFixture = new FixtureCodeInfo(0, "", posId, plateW, plateH,!isSingleOut);
//如果当前正在出库中,且库位号相同,暂不处理
if (StoreMove.MoveType.Equals(StoreMoveType.OutStore))
{
if (StoreMove.MoveParam.PositionNum.Equals(posId))
{
LogUtil.error(LOGGER, $"收到服务器出库命令:出库任务重复:当前正在【{posId}】出库执行中");
continue;
}
}
FixtureCodeInfo waitInfo = GetOutInfo(posId);
if (waitInfo != null)
{
LogUtil.error(LOGGER, $"收到服务器出库命令:出库任务重复:已存在库位号为【{posId}】的任务:【{waitInfo.ToStr()}】");
continue;
}
if (CanStarInOut())
{
bool result = StartOutStoreMove(new InOutStoreParam("", posId, plateH, plateW), !isSingleOut);
......@@ -2046,6 +2064,19 @@ namespace OnlineStore.DeviceLibrary
}
}
private FixtureCodeInfo GetOutInfo(string posId)
{
List<FixtureCodeInfo> waitoutlist = new List<FixtureCodeInfo>(waitOutStoreList);
foreach (FixtureCodeInfo codeInfo in waitoutlist)
{
if (codeInfo.PosId.Equals(posId))
{
return codeInfo;
}
}
return null;
}
#endregion
}
......
......@@ -318,7 +318,12 @@ namespace OnlineStore.DeviceLibrary
}
LogUtil.info(LOGGER, StoreName + logMsg);
storeRunStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.InStoreExecute;
if (StoreMove.IsNeedInStore)
{
storeStatus = StoreStatus.InStoreExecute;
}
StoreMove.NewMove(StoreMoveType.InStore, param);
//lastMoveType = StoreMoveType.InStore;
StoreMove.IsBatchInOutStore = IsBatchWork;
......@@ -705,49 +710,52 @@ namespace OnlineStore.DeviceLibrary
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.SIS_37_InoutToP2))
{
InStoreLog("入库:SIS_38 ,清理扫码信息,开始扫码,最多等待6000 ");
InStoreLog("入库:SIS_38 ,清理扫码信息,开始扫码,最多等待9000 ");
AutomaticBaiting.ClearInStoreInfo();
StoreMove.NextMoveStep(StoreMoveStep.SIS_38_ScanCode);
StoreMove.WaitList.Add(WaitResultInfo.WaitCodeOK());
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(9000));
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(5000));
StoreMove.OneWaitCanEndStep = true;
AutomaticBaiting.GetCameraCode();
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.SIS_38_ScanCode))
{
if (AutomaticBaiting.LastCode.Equals(""))
{
SingleSendOut("未扫到二维码");
}
else
{
InStoreLog("入库:SIS_39 获取入库库位号 ");
StoreMove.NextMoveStep(StoreMoveStep.SIS_39_GetPosId);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(10000));//最多等待十秒
InOutStoreParam param = AutomaticBaiting.GetInStoreParam("单盘入库", AutomaticBaiting.ProcessMsg());
if (param == null)
{
SingleSendOut("从服务器获取入库信息失败");
}
else if (!LoadParamPosition(param))
if (AutomaticBaiting.ScanTask == null || AutomaticBaiting.ScanTask.IsCompleted)
{
if (AutomaticBaiting.LastCode.Equals(""))
{
SingleSendOut("加载入库" + param.PositionNum + "参数失败");
SingleSendOut("未扫到二维码");
}
else
{
//更改当前入库参数
storeRunStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.InStoreExecute;
StoreMove.MoveParam = param;
moveP = StoreMove.MoveParam.MoveP;
//lastMoveType = StoreMoveType.InStore;
StoreMove.IsBatchInOutStore = true;
StoreMove.IsNeedInStore = true;
InStoreLog("入库:SIS_39 获取入库库位号 ");
StoreMove.NextMoveStep(StoreMoveStep.SIS_39_GetPosId);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(10000));//最多等待十秒
InOutStoreParam param = AutomaticBaiting.GetInStoreParam("单盘入库", AutomaticBaiting.ProcessMsg());
if (param == null)
{
SingleSendOut("从服务器获取入库信息失败");
}
else if (!LoadParamPosition(param))
{
SingleSendOut("加载入库" + param.PositionNum + "参数失败");
}
else
{
//更改当前入库参数
storeRunStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.InStoreExecute;
StoreMove.MoveParam = param;
moveP = StoreMove.MoveParam.MoveP;
//lastMoveType = StoreMoveType.InStore;
StoreMove.IsBatchInOutStore = true;
StoreMove.IsNeedInStore = true;
LogUtil.info("单盘入库获取库位号成功:" + param.ToStr() + ",叉子后退,压紧轴压紧[" + moveP.ComPress_P2 + "],开始入库");
StoreMove.NextMoveStep(StoreMoveStep.SI_07_InoutToP1);
ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Position);
ComMoveToPosition(moveP.ComPress_P2, Config.CompAxis_P2_Speed);
LogUtil.info("单盘入库获取库位号成功:" + param.ToStr() + ",叉子后退,压紧轴压紧[" + moveP.ComPress_P2 + "],开始入库");
StoreMove.NextMoveStep(StoreMoveStep.SI_07_InoutToP1);
ACAxisMove(Config.InOut_Axis, moveP.InOut_P1, Config.InOutAxis_P1_Position);
ComMoveToPosition(moveP.ComPress_P2, Config.CompAxis_P2_Speed);
}
}
}
}
......
......@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
......@@ -329,6 +330,7 @@ namespace OnlineStore.DeviceLibrary
}
}
private static int SuckingDisc_WorkCount = 0;
private static Task GetPosTask = null;
private static void InStoreProcess()
{
......@@ -359,9 +361,12 @@ namespace OnlineStore.DeviceLibrary
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I03_ScanCode))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I04_SuckingDisc_Down);
InStoreLog(" 扫码结束,二维码【" + LastCode + "】 吸盘开始下降");
CylinderMove(IO_Type.ClampingDisc_Down, IO_Type.ClampingDisc_Up, true);
if (ScanTask == null || ScanTask.IsCompleted)
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I04_SuckingDisc_Down);
InStoreLog(" 扫码结束,二维码【" + LastCode + "】 吸盘开始下降");
CylinderMove(IO_Type.ClampingDisc_Down, IO_Type.ClampingDisc_Up, true);
}
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I04_SuckingDisc_Down))
{
......@@ -476,11 +481,13 @@ namespace OnlineStore.DeviceLibrary
else
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I08_GetPosId);
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(2000));
LogUtil.debug(Name + StoreMove.MoveStep + "入料: 从服务器获取入库PosId,尺寸:【" + LastWidth + "*" + LastHeight + "】二维码【" + LastCode + "】");
GetInStorePosId(ProcessMsg());
StoreMove.WaitList.Add(WaitResultInfo.WaitTime(5000));
GetPosTask = null;
GetPosTask = Task.Factory.StartNew(delegate ()
{
GetInStorePosId(ProcessMsg());
});
}
}
else if (span.TotalSeconds > 60)
......@@ -503,20 +510,23 @@ namespace OnlineStore.DeviceLibrary
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I08_GetPosId))
{
//判断是否开始入库
if (StoreManager.Store.StoreMove.MoveType.Equals(StoreMoveType.InStore) || (!LastPosId.Equals("")))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I09_WaitTrayLeave);
InStoreLog(" 开始入库【" + LastPosId + "】,等待料盘拿走");
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Air, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Clamping_Relax, IO_VALUE.HIGH));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Clamping_Work, IO_VALUE.LOW));
}
else
if (GetPosTask == null || GetPosTask.IsCompleted)
{
InStoreLog(" 入库失败,尺寸:【" + LastWidth + "*" + LastHeight + "】将料盘送出,等待料盘拿走");
StoreManager.cancelPutInTask(LastSendCode);
SendTrayOut();
//判断是否开始入库
if (StoreManager.Store.StoreMove.MoveType.Equals(StoreMoveType.InStore) || (!LastPosId.Equals("")))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I09_WaitTrayLeave);
InStoreLog(" 开始入库【" + LastPosId + "】,等待料盘拿走");
//StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SuckingDisc_Air, IO_VALUE.LOW));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Clamping_Relax, IO_VALUE.HIGH));
StoreMove.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Clamping_Work, IO_VALUE.LOW));
}
else
{
InStoreLog(" 入库失败,尺寸:【" + LastWidth + "*" + LastHeight + "】将料盘送出,等待料盘拿走");
StoreManager.cancelPutInTask(LastSendCode);
SendTrayOut();
}
}
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I09_WaitTrayLeave))
......
......@@ -350,10 +350,14 @@ namespace OnlineStore.DeviceLibrary
#region Halcon扫码枪代码
public bool IsTestCamera = false;
private static string spiltStr = "##";
public static Task ScanTask = null;
public static void GetCameraCode()
{
Task.Factory.StartNew(delegate ()
ScanTask = Task.Factory.StartNew(delegate ()
{
LastCode = "";
LastCodeList = new List<string>();
DateTime startTime = DateTime.Now;
IOManager.IOMove(IO_Type.CameraLight_Power, IO_VALUE.HIGH);
string message = "";
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!