Commit 6848577d 张东亮

20230103

1 个父辈 a1f4eb60
...@@ -31,6 +31,10 @@ ...@@ -31,6 +31,10 @@
<!--是否打开托盘编码界面--> <!--是否打开托盘编码界面-->
<add key="DefaultPWD" value="123456" /> <add key="DefaultPWD" value="123456" />
<add key="Server_Log_Open" value="0" /> <add key="Server_Log_Open" value="0" />
<!--任务限制数量-->
<add key="TaskCnt" value="30" />
<!--横移3出库箱子等待超时时间-->
<add key="HY3_WaitTimeOut" value="30" />
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
...@@ -554,7 +554,8 @@ namespace OnlineStore.AssemblyLine ...@@ -554,7 +554,8 @@ namespace OnlineStore.AssemblyLine
msg += t.ToStr() + "\r\n"; msg += t.ToStr() + "\r\n";
} }
msg += "---------结束打印容器信息----------"; msg += "---------结束打印容器信息----------";
MessageBox.Show(msg, "容器信息列表"); var outTask = ContainerManager.getTrayList().FindAll(s => s.InOrOutStore.Equals(ContainerType.OutStore));
MessageBox.Show(msg, $"容器信息列表[{outTask?.Count??0}]/[{tray?.Count ?? 0}]");
} }
......
...@@ -29,7 +29,7 @@ namespace OnlineStore.AssemblyLine ...@@ -29,7 +29,7 @@ namespace OnlineStore.AssemblyLine
comboxType.Items.Clear(); comboxType.Items.Clear();
foreach (EquipBase b in LineManager.Line.AllEquipMap.Values) foreach (EquipBase b in LineManager.Line.AllEquipMap.Values)
{ {
b.OpenRfid(); //b.OpenRfid();
List<string> value = RFIDManager.GetRFIP(b.DeviceID); List<string> value = RFIDManager.GetRFIP(b.DeviceID);
if (value != null && value.Count > 0) if (value != null && value.Count > 0)
{ {
...@@ -73,13 +73,13 @@ namespace OnlineStore.AssemblyLine ...@@ -73,13 +73,13 @@ namespace OnlineStore.AssemblyLine
private void FrmRFIPEdit_FormClosed(object sender, FormClosedEventArgs e) private void FrmRFIPEdit_FormClosed(object sender, FormClosedEventArgs e)
{ {
if (LineManager.Line.runStatus <= LineRunStatus.Wait) //if (LineManager.Line.runStatus <= LineRunStatus.Wait)
{ //{
foreach (EquipBase b in LineManager.Line.AllEquipMap.Values) // foreach (EquipBase b in LineManager.Line.AllEquipMap.Values)
{ // {
b.CloseRfid(); // b.CloseRfid();
} // }
} //}
} }
} }
} }
...@@ -49,5 +49,6 @@ namespace OnlineStore.Common ...@@ -49,5 +49,6 @@ namespace OnlineStore.Common
public static string DisTraySave = "DisTraySave"; public static string DisTraySave = "DisTraySave";
public static string ESS_Server = "ESS_Server"; public static string ESS_Server = "ESS_Server";
public static string Webservice = "Webservice"; public static string Webservice = "Webservice";
public static string HY3_WaitTimeOut = "HY3_WaitTimeOut";
} }
} }
...@@ -169,7 +169,7 @@ namespace OnlineStore.Common ...@@ -169,7 +169,7 @@ namespace OnlineStore.Common
{ {
LogUtil.error("POST [" + url + "] ERROR:" + e.ToString(), 101); LogUtil.error("POST [" + url + "] ERROR:" + e.ToString(), 101);
} }
if (!resultMsg.Contains("null") && resultMsg.Length != 0) if (resultMsg.Length != 0)//!resultMsg.Contains("null") &&
{ {
return true; return true;
} }
......
...@@ -81,8 +81,8 @@ namespace OnlineStore.DeviceLibrary.ESS ...@@ -81,8 +81,8 @@ namespace OnlineStore.DeviceLibrary.ESS
{ {
ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.IN_ON_AGV); ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.IN_ON_AGV);
} }
else if (essModel.status.Equals("cancel")) //else if (essModel.status.Equals("cancel"))
ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.ERROR); // ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.ERROR);
} }
else if(essModel.eventType?.Equals("task")??false) else if(essModel.eventType?.Equals("task")??false)
{ {
...@@ -90,8 +90,8 @@ namespace OnlineStore.DeviceLibrary.ESS ...@@ -90,8 +90,8 @@ namespace OnlineStore.DeviceLibrary.ESS
{ {
ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.FINISHED); ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.FINISHED);
} }
else if (essModel.status.Equals("cancel")) //else if (essModel.status.Equals("cancel"))
ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.ERROR); // ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.WAIT);
} }
} }
else if (essModel.taskCode?.ToLower().StartsWith("out") ?? false) else if (essModel.taskCode?.ToLower().StartsWith("out") ?? false)
...@@ -102,8 +102,8 @@ namespace OnlineStore.DeviceLibrary.ESS ...@@ -102,8 +102,8 @@ namespace OnlineStore.DeviceLibrary.ESS
{ {
ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.OUT_ON_AGV); ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.OUT_ON_AGV);
} }
else if (essModel.status.Equals("cancel")) //else if (essModel.status.Equals("cancel"))
ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.ERROR); // ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.ERROR);
} }
else if (essModel.eventType?.Equals("task") ?? false) else if (essModel.eventType?.Equals("task") ?? false)
{ {
...@@ -117,8 +117,8 @@ namespace OnlineStore.DeviceLibrary.ESS ...@@ -117,8 +117,8 @@ namespace OnlineStore.DeviceLibrary.ESS
// LineManager.StartStationInStore(info.InoutParam); // LineManager.StartStationInStore(info.InoutParam);
//} //}
} }
else if (essModel.status.Equals("cancel")) //else if (essModel.status.Equals("cancel"))
ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.ERROR); // ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.ERROR);
} }
} }
......
...@@ -57,7 +57,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -57,7 +57,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(LineMoveStep.HY_R_01StopMove); MoveInfo.NextMoveStep(LineMoveStep.HY_R_01StopMove);
LogInfo("开始复位,横移线体停止 "); LogInfo("开始复位,横移线体停止 ");
LineStop(MoveInfo); LineStop(MoveInfo);
if (IsHY2() &&IOValue(IO_Type.HY_BoxCheck).Equals(IO_VALUE.HIGH)) if (IsHY2() && IOValue(IO_Type.HY_BoxCheck).Equals(IO_VALUE.HIGH))
{ {
JackingDown(MoveInfo); JackingDown(MoveInfo);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
...@@ -275,6 +275,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -275,6 +275,8 @@ namespace OnlineStore.DeviceLibrary
{ {
UpdateContainerCode(); UpdateContainerCode();
} }
bool hy3ToDischarge = false;
int hy3WaitTime = ConfigAppSettings.GetIntValue(Setting_Init.HY3_WaitTimeOut);
protected override void BoxProcess() protected override void BoxProcess()
{ {
if (MoveInfo.IsInWait) if (MoveInfo.IsInWait)
...@@ -327,34 +329,52 @@ namespace OnlineStore.DeviceLibrary ...@@ -327,34 +329,52 @@ namespace OnlineStore.DeviceLibrary
ContainerInfo trayInfo = ContainerManager.GetTrayInfo(CurContainerId); ContainerInfo trayInfo = ContainerManager.GetTrayInfo(CurContainerId);
if (trayInfo?.InOrOutStore == ContainerType.InStore)//入库 if (trayInfo?.InOrOutStore == ContainerType.InStore)//入库
{ {
if (IsDischargeIdle())
{
JackingDown(MoveInfo); JackingDown(MoveInfo);
} }
else else
{ {
JackingUp(MoveInfo); JackingUp(MoveInfo);
} }
}
else
{
JackingUp(MoveInfo);
}
} }
else if (MoveInfo.IsStep(LineMoveStep.HY34_GetBoxInfo)) else if (MoveInfo.IsStep(LineMoveStep.HY34_GetBoxInfo))
{ {
MoveInfo.NextMoveStep(LineMoveStep.HY35_CheckDownriver);
LogInfo(" 检查下游状态");
ContainerInfo trayInfo = ContainerManager.GetTrayInfo(CurContainerId); ContainerInfo trayInfo = ContainerManager.GetTrayInfo(CurContainerId);
if (trayInfo?.InOrOutStore == ContainerType.InStore)//入库 if (trayInfo?.InOrOutStore == ContainerType.InStore)//入库
{ {
if (IsDischargeIdle())
{
MoveInfo.NextMoveStep(LineMoveStep.HY35_CheckDownriver);
LogInfo("入库容器,出料工位空闲,流到出料工位");
JackingDown(MoveInfo); JackingDown(MoveInfo);
hy3ToDischarge = true;
}
else if(MoveInfo.IsTimeOut(hy3WaitTime))
{
MoveInfo.NextMoveStep(LineMoveStep.HY35_CheckDownriver);
LogInfo($"入库容器,等待{hy3WaitTime}秒超时,直接流转");
JackingUp(MoveInfo);
hy3ToDischarge = false;
}
} }
else else
{ {
MoveInfo.NextMoveStep(LineMoveStep.HY35_CheckDownriver);
LogInfo("出库容器,直接流转");
JackingUp(MoveInfo); JackingUp(MoveInfo);
hy3ToDischarge = false;
} }
} }
else if (MoveInfo.IsStep(LineMoveStep.HY35_CheckDownriver)) else if (MoveInfo.IsStep(LineMoveStep.HY35_CheckDownriver))
{ {
ContainerInfo trayInfo = ContainerManager.GetTrayInfo(CurContainerId); if (hy3ToDischarge)//入库
if (trayInfo?.InOrOutStore == ContainerType.InStore)//入库
{
if (IsDischargeIdle())
{ {
MoveInfo.NextMoveStep(LineMoveStep.HY36_ReleaseBox); MoveInfo.NextMoveStep(LineMoveStep.HY36_ReleaseBox);
ClearSpecifiedWarnMsg("等待出料工位空闲超时"); ClearSpecifiedWarnMsg("等待出料工位空闲超时");
...@@ -363,11 +383,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -363,11 +383,7 @@ namespace OnlineStore.DeviceLibrary
StopDown(MoveInfo); StopDown(MoveInfo);
LineManager.StartDisChargeMove(); LineManager.StartDisChargeMove();
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
}
else if (MoveInfo.IsTimeOut(30))
{
SetWarnMsg("等待出料工位空闲超时");
}
} }
else else
{ {
...@@ -386,12 +402,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -386,12 +402,11 @@ namespace OnlineStore.DeviceLibrary
SetWarnMsg("等待横移4空闲超时"); SetWarnMsg("等待横移4空闲超时");
} }
} }
} }
else if (MoveInfo.IsStep(LineMoveStep.HY36_ReleaseBox)) else if (MoveInfo.IsStep(LineMoveStep.HY36_ReleaseBox))
{ {
ContainerInfo trayInfo = ContainerManager.GetTrayInfo(CurContainerId); ContainerInfo trayInfo = ContainerManager.GetTrayInfo(CurContainerId);
if (trayInfo?.InOrOutStore == ContainerType.InStore)//入库 if (hy3ToDischarge)//入库
{ {
if (BoxReachDischarge()) if (BoxReachDischarge())
{ {
...@@ -435,7 +450,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -435,7 +450,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(LineMoveStep.HY21_WaitBoxCheck); MoveInfo.NextMoveStep(LineMoveStep.HY21_WaitBoxCheck);
LogInfo($"等待容器到位"); LogInfo($"等待容器到位");
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_BoxCheck, IO_VALUE.HIGH)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.HY_BoxCheck, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1500));
} }
else if (MoveInfo.IsStep(LineMoveStep.HY21_WaitBoxCheck)) else if (MoveInfo.IsStep(LineMoveStep.HY21_WaitBoxCheck))
{ {
...@@ -454,11 +469,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -454,11 +469,11 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(LineMoveStep.HY23_WaitBoxLeave)) else if (MoveInfo.IsStep(LineMoveStep.HY23_WaitBoxLeave))
{ {
MoveInfo.NextMoveStep(LineMoveStep.HY24_JackingUp); MoveInfo.NextMoveStep(LineMoveStep.HY24_JackingUp);
if (LineManager.IsFeedingHasBox()) //if (LineManager.IsFeedingHasBox())
{ //{
LogInfo($"入料工位有容器,顶升不动作"); // LogInfo($"入料工位有容器,顶升不动作");
} //}
else //else
{ {
LogInfo($"入料工位无容器,顶升上升"); LogInfo($"入料工位无容器,顶升上升");
JackingUp(MoveInfo); JackingUp(MoveInfo);
......
...@@ -800,21 +800,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -800,21 +800,16 @@ namespace OnlineStore.DeviceLibrary
return msg; return msg;
} }
private bool conIsPro = false; private object conIsPro = new object();
private DateTime conLastTime = DateTime.Now; private DateTime conLastTime = DateTime.Now;
private DateTime callOutLastTime = DateTime.Now;
private void ServerConTimer_Elapsed(object sender, ElapsedEventArgs e) private void ServerConTimer_Elapsed(object sender, ElapsedEventArgs e)
{ {
if(Monitor.TryEnter(conIsPro))
TimeSpan span = DateTime.Now - conLastTime;
if (conIsPro && span.TotalSeconds < 30)
{ {
return;
}
try try
{ {
conIsPro = true; #region 异常上报 未使用
conLastTime = DateTime.Now;
#region 异常上报
//List<AlarmMsg> alarmList = new List<AlarmMsg>(); //List<AlarmMsg> alarmList = new List<AlarmMsg>();
//foreach (EquipBase equip in AllEquipMap.Values) //foreach (EquipBase equip in AllEquipMap.Values)
//{ //{
...@@ -874,6 +869,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -874,6 +869,10 @@ namespace OnlineStore.DeviceLibrary
RobotStates states = SServerManager.GetRobotState(); RobotStates states = SServerManager.GetRobotState();
if (LineManager.RobotIsIdle(states) || LineManager.CheckRobotTrayIsInstore(states)) if (LineManager.RobotIsIdle(states) || LineManager.CheckRobotTrayIsInstore(states))
{ {
TimeSpan span1 = DateTime.Now - callOutLastTime;
if (span1.TotalSeconds > 15)
{
callOutLastTime = DateTime.Now;
foreach (var item in outTask) foreach (var item in outTask)
{ {
ContainerManager.AddOrUpdateContainerInfo(item.barcode); ContainerManager.AddOrUpdateContainerInfo(item.barcode);
...@@ -881,6 +880,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -881,6 +880,8 @@ namespace OnlineStore.DeviceLibrary
} }
} }
}
//发送呼叫任务 //发送呼叫任务
ContainerManager.HandlePendingTask(); ContainerManager.HandlePendingTask();
//上报容器状态 //上报容器状态
...@@ -892,7 +893,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -892,7 +893,8 @@ namespace OnlineStore.DeviceLibrary
} }
finally finally
{ {
conIsPro = false; Monitor.Exit(conIsPro);
}
} }
} }
......
...@@ -166,12 +166,23 @@ namespace OnlineStore.DeviceLibrary ...@@ -166,12 +166,23 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(LineMoveStep.SI_05_WaitBoxLeave); MoveInfo.NextMoveStep(LineMoveStep.SI_05_WaitBoxLeave);
LogInfo($"等待出库容器被拿走"); LogInfo($"等待出库容器被拿走");
AddWaitBoxCheck(false); AddWaitBoxCheck(false);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(15000));
MoveInfo.OneWaitCanEndStep = true;
} }
else if (MoveInfo.IsStep(LineMoveStep.SI_05_WaitBoxLeave)) else if (MoveInfo.IsStep(LineMoveStep.SI_05_WaitBoxLeave))
{ {
if(IOValue(IO_Type.Stop_BoxCheck).Equals(IO_VALUE.HIGH))
{
MoveInfo.NextMoveStep(LineMoveStep.SI_08_StopDown);
LogInfo($"出库容器被拿走超时,放行");
StopDown(MoveInfo);
}
else
{
MoveInfo.NextMoveStep(LineMoveStep.SI_06_WaitBoxAtStation); MoveInfo.NextMoveStep(LineMoveStep.SI_06_WaitBoxAtStation);
LogInfo($"出库容器被拿走,等待容器到达工作台"); LogInfo($"出库容器被拿走,等待容器到达工作台");
} }
}
else if (MoveInfo.IsStep(LineMoveStep.SI_06_WaitBoxAtStation)) else if (MoveInfo.IsStep(LineMoveStep.SI_06_WaitBoxAtStation))
{ {
EquipBase equipBase = GetOutEquip(); EquipBase equipBase = GetOutEquip();
...@@ -187,28 +198,30 @@ namespace OnlineStore.DeviceLibrary ...@@ -187,28 +198,30 @@ namespace OnlineStore.DeviceLibrary
} }
} }
ClearSpecifiedWarnMsg($"等待容器到达下游"); ClearSpecifiedWarnMsg($"等待容器到达下游");
if (MoveInfo.IsTimeOut(30)) if (MoveInfo.IsTimeOut(15))
{ {
MoveInfo.NextMoveStep(LineMoveStep.SI_07_AllStopDown); MoveInfo.NextMoveStep(LineMoveStep.SI_07_AllStopDown);
if (ContainerManager.GetInTaskCnt(DeviceID) > 0) //if (ContainerManager.GetInTaskCnt(DeviceID) > 0)
{ //{
LogInfo($"容器到达工作台30秒超时,该工位将有出库容器到达,前阻挡下降"); // LogInfo($"容器到达工作台30秒超时,该工位将有出库容器到达,前阻挡下降");
FrontStopDown(MoveInfo); // FrontStopDown(MoveInfo);
} //}
else if (ContainerManager.GetOutTaskCnt(DeviceID) > 0) //else if (ContainerManager.GetOutTaskCnt(DeviceID) > 0)
{ //{
LogInfo($"容器到达工作台30秒超时,该工位将有入库容器离开,阻挡下降"); // LogInfo($"容器到达工作台30秒超时,该工位将有入库容器离开,阻挡下降");
StopDown(MoveInfo); // StopDown(MoveInfo);
} //}
else if(DeviceID==5) //else
if(DeviceID==5)
{ {
LogInfo($"容器到达工作台30秒超时,前阻挡下降"); LogInfo($"容器到达工作台15秒超时,前阻挡下降");
FrontStopDown(MoveInfo); FrontStopDown(MoveInfo);
} }
else else
{ {
LogInfo($"容器到达工作台30秒超时,所有阻挡下降"); LogInfo($"容器到达工作台15秒超时,所有阻挡下降");
StopDown(MoveInfo); StopDown(MoveInfo);
FrontStopDown(MoveInfo); FrontStopDown(MoveInfo);
} }
...@@ -220,17 +233,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -220,17 +233,19 @@ namespace OnlineStore.DeviceLibrary
if (CurShelfId_Station.Equals(CurContainerId)) if (CurShelfId_Station.Equals(CurContainerId))
{ {
MoveInfo.NextMoveStep(LineMoveStep.SI_07_AllStopDown); MoveInfo.NextMoveStep(LineMoveStep.SI_07_AllStopDown);
if (ContainerManager.GetInTaskCnt(DeviceID) > 0) //if (ContainerManager.GetInTaskCnt(DeviceID) > 0)
{ //{
LogInfo($" 容器到达工作台,该工位将有出库容器到达,前阻挡下降"); // LogInfo($" 容器到达工作台,该工位将有出库容器到达,前阻挡下降");
FrontStopDown(MoveInfo); // FrontStopDown(MoveInfo);
} //}
else if (ContainerManager.GetOutTaskCnt(DeviceID) > 0) //else if (ContainerManager.GetOutTaskCnt(DeviceID) > 0)
{ //{
LogInfo($"容器到达工作台,该工位将有入库容器离开,阻挡下降"); // LogInfo($"容器到达工作台,该工位将有入库容器离开,阻挡下降");
StopDown(MoveInfo); // StopDown(MoveInfo);
} //}
else if (DeviceID == 5) //else
if (DeviceID == 5)
{ {
LogInfo($"箱子到达工作台,前阻挡下降"); LogInfo($"箱子到达工作台,前阻挡下降");
FrontStopDown(MoveInfo); FrontStopDown(MoveInfo);
...@@ -272,17 +287,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -272,17 +287,19 @@ namespace OnlineStore.DeviceLibrary
} }
ClearSpecifiedWarnMsg($"等待容器到达下游"); ClearSpecifiedWarnMsg($"等待容器到达下游");
MoveInfo.NextMoveStep(LineMoveStep.SI_10_FrontStopDown); MoveInfo.NextMoveStep(LineMoveStep.SI_10_FrontStopDown);
if (ContainerManager.GetInTaskCnt(DeviceID) > 1) //if (ContainerManager.GetInTaskCnt(DeviceID) > 1)
{ //{
LogInfo($"该工位将有出库容器到达,阻挡上升,前阻挡下降"); // LogInfo($"该工位将有出库容器到达,阻挡上升,前阻挡下降");
StopUp(MoveInfo); // StopUp(MoveInfo);
FrontStopDown(MoveInfo); // FrontStopDown(MoveInfo);
} //}
else if (ContainerManager.GetOutTaskCnt(DeviceID) > 0) //else if (ContainerManager.GetOutTaskCnt(DeviceID) > 0)
{ //{
LogInfo($"该工位将有入库容器离开,前阻挡保持上升"); // LogInfo($"该工位将有入库容器离开,前阻挡保持上升");
} //}
else if (DeviceID == 5)//工位5放行一个容器后前阻挡上升 //else
if (DeviceID == 5)//工位5放行一个容器后前阻挡上升
{ {
LogInfo($"阻挡上升"); LogInfo($"阻挡上升");
StopUp(MoveInfo); StopUp(MoveInfo);
......
...@@ -39,8 +39,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -39,8 +39,8 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.NextMoveStep(LineMoveStep.SO_02_WaitBoxInToLine); MoveInfo.NextMoveStep(LineMoveStep.SO_02_WaitBoxInToLine);
AddWaitBoxCheck(true); AddWaitBoxCheck(true);
WaitTime(3000); WaitTime(15000);
//MoveInfo.OneWaitCanEndStep = true; MoveInfo.OneWaitCanEndStep = true;
LogInfo($"等待箱子离开工作站"); LogInfo($"等待箱子离开工作站");
} }
else if (MoveInfo.IsStep(LineMoveStep.SO_02_WaitBoxInToLine)) else if (MoveInfo.IsStep(LineMoveStep.SO_02_WaitBoxInToLine))
......
...@@ -172,7 +172,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -172,7 +172,7 @@ namespace OnlineStore.DeviceLibrary
} }
public static void StartStationInStore(InOutParam inOutParam) public static void StartStationInStore(InOutParam inOutParam)
{ {
if(Line?.AllEquipMap.ContainsKey(inOutParam.DeviceId)??false) if (Line?.AllEquipMap.ContainsKey(inOutParam.DeviceId) ?? false)
{ {
Line?.AllEquipMap[inOutParam.DeviceId].StartInStoreMove(inOutParam); Line?.AllEquipMap[inOutParam.DeviceId].StartInStoreMove(inOutParam);
} }
...@@ -196,18 +196,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -196,18 +196,22 @@ namespace OnlineStore.DeviceLibrary
{ {
try try
{ {
if(robotStates !=null && robotStates.robots!=null) if (robotStates != null && robotStates.robots != null)
{ {
foreach (var item in robotStates.robots) foreach (var item in robotStates.robots)
{ {
if (!item.state.Equals("IDLE")) continue; if (!item.state.Equals("IDLE")) continue;
var fullTray = item.trays.FindAll(s => s.containerCode != null); var fullTray = item.trays.FindAll(s => s.containerCode != null);
if (fullTray == null) return true; if (fullTray == null || fullTray.Count == 0)
{
LogUtil.info($"机器人空闲且背篓为空,允许发送出库任务:【{JsonHelper.SerializeObject(item)}】");
return true;
}
} }
} }
} }
catch(Exception ex) catch (Exception ex)
{ {
LogUtil.error("RobotTrayIsEmpty", ex); LogUtil.error("RobotTrayIsEmpty", ex);
} }
...@@ -233,10 +237,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -233,10 +237,13 @@ namespace OnlineStore.DeviceLibrary
{ {
var instore = ContainerManager.GetTrayInfo(tray.containerCode); var instore = ContainerManager.GetTrayInfo(tray.containerCode);
if (instore != null && instore.InOrOutStore.Equals(ContainerType.InStore)) if (instore != null && instore.InOrOutStore.Equals(ContainerType.InStore))
{
LogUtil.info($"机器人背篓有入库容器,允许发送出库任务:【{JsonHelper.SerializeObject(item)}】【{JsonHelper.SerializeObject(instore)}】");
return true; return true;
} }
} }
} }
}
} }
} }
...@@ -246,13 +253,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -246,13 +253,18 @@ namespace OnlineStore.DeviceLibrary
} }
return false; return false;
} }
static int taskCnt = ConfigAppSettings.GetIntValue("TaskCnt");
/// <summary> /// <summary>
/// 检查容器任务数是否超限 /// 检查容器出库任务数是否超限
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public static bool CheckTaskCntIsInLimit() public static bool CheckTaskCntIsInLimit()
{ {
return ContainerManager.getTrayList().Count <= 30; var outTask = ContainerManager.getTrayList().FindAll(s => s.InOrOutStore.Equals(ContainerType.OutStore));
if (taskCnt > 0)
return outTask?.Count <= taskCnt;//30
else
return outTask?.Count <= 8;//30
} }
#endregion #endregion
} }
......
...@@ -48,18 +48,18 @@ namespace OnlineStore.DeviceLibrary ...@@ -48,18 +48,18 @@ namespace OnlineStore.DeviceLibrary
/// <returns></returns> /// <returns></returns>
public static int CntofContainerOnLine() public static int CntofContainerOnLine()
{ {
try //try
{ //{
List<ContainerInfo> containers= getTrayList().FindAll(s=>(s.Status.Equals(TaskStatus.IN_ON_LINE) || s.Status.Equals(TaskStatus.OUT_ON_LINE))); // List<ContainerInfo> containers= getTrayList().FindAll(s=>(s.Status.Equals(TaskStatus.IN_ON_LINE) || s.Status.Equals(TaskStatus.OUT_ON_LINE)));
if(containers!=null) // if(containers!=null)
{ // {
return containers.Count; // return containers.Count;
} // }
} //}
catch (Exception ex) //catch (Exception ex)
{ //{
LogUtil.error($"CntofContainerOnLine", ex); // LogUtil.error($"CntofContainerOnLine", ex);
} //}
return 0; return 0;
} }
/// <summary> /// <summary>
...@@ -84,7 +84,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -84,7 +84,7 @@ namespace OnlineStore.DeviceLibrary
{ {
foreach (var item in getTrayList()) foreach (var item in getTrayList())
{ {
bool rtn = SServerManager.UpdateLocInfo("ContainerManager", item.ContainerValidCode, item.Status, item.CurLoc); bool rtn = SServerManager.UpdateLocInfo("ContainerManager", item.ContainerValidCode, item.Status, item.CurLoc,out bool canRemove);
if (rtn) if (rtn)
{ {
if (item.Status.Equals(TaskStatus.ERROR)) if (item.Status.Equals(TaskStatus.ERROR))
...@@ -95,7 +95,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -95,7 +95,12 @@ namespace OnlineStore.DeviceLibrary
else if (item.Status.Equals(TaskStatus.FINISHED)) else if (item.Status.Equals(TaskStatus.FINISHED))
{ {
bool res = containerInfoMap.TryRemove(item.ContainerValidCode, out ContainerInfo containerInfo); bool res = containerInfoMap.TryRemove(item.ContainerValidCode, out ContainerInfo containerInfo);
LogUtil.info($"任务完成【{res}】:【{JsonHelper.SerializeObject(containerInfo)}】"); LogUtil.info($"任务完成,自动删除该任务【{res}】:【{JsonHelper.SerializeObject(containerInfo)}】");
}
else if(canRemove)
{
bool res = containerInfoMap.TryRemove(item.ContainerValidCode, out ContainerInfo containerInfo);
LogUtil.info($"任务不存在,自动删除该任务【{res}】:【{JsonHelper.SerializeObject(containerInfo)}】");
} }
} }
} }
...@@ -454,7 +459,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -454,7 +459,6 @@ namespace OnlineStore.DeviceLibrary
static object saveObj = new object(); static object saveObj = new object();
static void SaveMapToFile() static void SaveMapToFile()
{ {
LogUtil.info("SaveMapToFile");
if (Monitor.TryEnter(saveObj, 500)) if (Monitor.TryEnter(saveObj, 500))
{ {
try try
......
...@@ -22,12 +22,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -22,12 +22,12 @@ namespace OnlineStore.DeviceLibrary
{ {
if (RfidMap.ContainsKey(ip)) if (RfidMap.ContainsKey(ip))
{ {
return; if (RfidMap[ip].IsConn)
RfidMap[ip].Close();
RfidMap.TryRemove(ip, out PuYueRFID_C2S puYueRFID_C2S);
} }
PuYueRFID_C2S rfid = new PuYueRFID_C2S(ip, true); PuYueRFID_C2S rfid = new PuYueRFID_C2S(ip, true);
//rfid.StartAddr = 0x20; //rfid.ID_Changed_Event += Rfid_ID_Changed_Event;
//rfid.Length = 16;
rfid.ID_Changed_Event += Rfid_ID_Changed_Event;
if (rfid.IsConn) if (rfid.IsConn)
rfid.Close(); rfid.Close();
else else
......
...@@ -12,6 +12,7 @@ using System.Text; ...@@ -12,6 +12,7 @@ using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using static System.Windows.Forms.VisualStyles.VisualStyleElement; using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Tab;
namespace OnlineStore.DeviceLibrary namespace OnlineStore.DeviceLibrary
{ {
...@@ -314,7 +315,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -314,7 +315,6 @@ namespace OnlineStore.DeviceLibrary
} }
return list; return list;
} }
/// <summary> /// <summary>
/// B 获取出库任务列表 /// B 获取出库任务列表
/// </summary> /// </summary>
...@@ -420,9 +420,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -420,9 +420,10 @@ namespace OnlineStore.DeviceLibrary
/// <param name="status">状态</param> /// <param name="status">状态</param>
/// <param name="locInfo">位置</param> /// <param name="locInfo">位置</param>
/// <returns></returns> /// <returns></returns>
public static bool UpdateLocInfo(string deviceName, string barcode, string status, string locInfo = "") public static bool UpdateLocInfo(string deviceName, string barcode, string status, string locInfo ,out bool canRemove)
{ {
string msg = ""; string msg = "";
canRemove = false;
try try
{ {
if (String.IsNullOrEmpty(barcode)) if (String.IsNullOrEmpty(barcode))
...@@ -452,22 +453,25 @@ namespace OnlineStore.DeviceLibrary ...@@ -452,22 +453,25 @@ namespace OnlineStore.DeviceLibrary
} }
else if (serverResult.code.Equals(303).Equals(true)) else if (serverResult.code.Equals(303).Equals(true))
{ {
canRemove = true;
// code: 0为正常,其他为异常, msg: 消息, data: 为空 // code: 0为正常,其他为异常, msg: 消息, data: 为空
msg = deviceName + " UpdateTrayLoc 任务已完成【" + barcode + "】【" + status + "】【" + locInfo + "】 :" + "【" + serverResult.code + "】" + serverResult.msg; msg = deviceName + " UpdateTrayLoc 任务已完成【" + barcode + "】【" + status + "】【" + locInfo + "】 :" + "【" + serverResult.code + "】" + serverResult.msg;
LogUtil.info(msg); //LogUtil.info(msg);
return true; return true;
} }
else if (serverResult.code.Equals(0).Equals(false)) else if (serverResult.code.Equals(0).Equals(true))
{ {
// code: 0为正常,其他为异常, msg: 消息, data: 为空 // code: 0为正常,其他为异常, msg: 消息, data: 为空
msg = deviceName + " UpdateTrayLoc【" + barcode + "】【" + status + "】【" + locInfo + "】 :" + "【" + serverResult.code + "】" + serverResult.msg; msg = deviceName + " UpdateTrayLoc【" + barcode + "】【" + status + "】【" + locInfo + "】 :" + "【" + serverResult.code + "】" + serverResult.msg;
// LogUtil.info(msg);
return true;
} }
if (!msg.Equals("")) if (!msg.Equals(""))
{ {
LogUtil.error(msg); LogUtil.error(msg);
return false; return false;
} }
return true;
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -489,7 +493,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -489,7 +493,9 @@ namespace OnlineStore.DeviceLibrary
try try
{ {
string path = ess_server + Addr_GetRobotState; string path = ess_server + Addr_GetRobotState;
if (HttpHelper.Post(path, "", out bool isTimueOut, out string outMsg)) Dictionary<string, object> tmp = new Dictionary<string, object>();
string param = JsonHelper.SerializeObject(tmp);
if (HttpHelper.Post(path, param, out bool isTimueOut, out string outMsg))
{ {
ResultData resultData = JsonHelper.DeserializeJsonToObject<ResultData>(outMsg); ResultData resultData = JsonHelper.DeserializeJsonToObject<ResultData>(outMsg);
if (resultData != null) if (resultData != null)
......
...@@ -354,10 +354,14 @@ public class PuYueRFID_C2S ...@@ -354,10 +354,14 @@ public class PuYueRFID_C2S
} }
} }
object locRead = new object();
public bool ReadByte(short address, short length, out byte[] data) public bool ReadByte(short address, short length, out byte[] data)
{ {
data = null;
if (Monitor.TryEnter(locRead))
{
try
{
if (length > 64) if (length > 64)
throw new Exception("最大读取64个字节"); throw new Exception("最大读取64个字节");
data = null; data = null;
...@@ -399,7 +403,7 @@ public class PuYueRFID_C2S ...@@ -399,7 +403,7 @@ public class PuYueRFID_C2S
seqadd(); seqadd();
tcpClient.Client.Send(by); tcpClient.Client.Send(by);
Thread.Sleep(5); Thread.Sleep(5);
ulength = tcpClient?.Client?.Receive(result)??0; ulength = tcpClient?.Client?.Receive(result) ?? 0;
} }
catch (SocketException se) catch (SocketException se)
...@@ -434,6 +438,13 @@ public class PuYueRFID_C2S ...@@ -434,6 +438,13 @@ public class PuYueRFID_C2S
if (tcpClient.Client.Available > 0) if (tcpClient.Client.Available > 0)
_ = tcpClient.Client.Receive(result); _ = tcpClient.Client.Receive(result);
} }
}finally
{
Monitor.Exit(locRead);
}
}
return false; return false;
} }
/// <summary> /// <summary>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!