Commit 7177613c LN

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

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