Commit bc4198a4 张东亮

称重逻辑OK

1 个父辈 3a0bb722
...@@ -163,7 +163,11 @@ public class BSQController ...@@ -163,7 +163,11 @@ public class BSQController
} }
if (!Monitor.TryEnter(sb)) if (!Monitor.TryEnter(sb))
{
weight = LastWeight;
return false; return false;
}
try try
{ {
...@@ -193,7 +197,8 @@ public class BSQController ...@@ -193,7 +197,8 @@ public class BSQController
} }
catch (Exception e) catch (Exception e)
{ {
LogUtil.debug(LogName + e.ToString()); LastWeight = 0;
LogUtil.error(LogName + e.ToString());
return false; return false;
} }
finally finally
......
...@@ -131,6 +131,7 @@ namespace DeviceLibrary ...@@ -131,6 +131,7 @@ namespace DeviceLibrary
if (MoveInfo == null) if (MoveInfo == null)
{ {
AbsMove(targetPosition, targetSpeed); AbsMove(targetPosition, targetSpeed);
LogUtil.info($"{this.AxisName} AbsMove To [{targetPosition}] [speed={targetSpeed}][MoveInfo = null]");
} }
else else
{ {
...@@ -139,6 +140,7 @@ namespace DeviceLibrary ...@@ -139,6 +140,7 @@ namespace DeviceLibrary
var AddSpeed = Config.AddSpeed > 0 ? Config.AddSpeed : targetSpeed * 4; var AddSpeed = Config.AddSpeed > 0 ? Config.AddSpeed : targetSpeed * 4;
var DelSpeed = Config.DelSpeed > 0 ? Config.DelSpeed : targetSpeed * 4; var DelSpeed = Config.DelSpeed > 0 ? Config.DelSpeed : targetSpeed * 4;
AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, AddSpeed, DelSpeed);// Config.AddSpeed, Config.DelSpeed); AxisManager.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, AddSpeed, DelSpeed);// Config.AddSpeed, Config.DelSpeed);
LogUtil.info($"{this.AxisName} AbsMove To [{targetPosition}] [speed={targetSpeed}]");
} }
} }
......
using OnlineStore.LoadCSVLibrary; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -26,27 +27,28 @@ namespace DeviceLibrary ...@@ -26,27 +27,28 @@ namespace DeviceLibrary
public event Action<string, StoreMoveType, bool> InOutEndProcessEvent; public event Action<string, StoreMoveType, bool> InOutEndProcessEvent;
public bool IsComplateOrFree { get => MoveInfo.MoveStep == MoveStep.Wait; } public bool IsComplateOrFree { get => MoveInfo.MoveStep == MoveStep.Wait; }
public bool IsTakedBox { get => MoveInfo.MoveStep >= MoveStep.StoreTS10; } public bool IsTakedBox { get => MoveInfo.MoveStep >= MoveStep.StoreTS10; }
public bool IsPutOnOut {get=>(To.posid== BoxStorePosition.rightdoor || To.posid == BoxStorePosition.leftdoor) && MoveInfo.MoveStep >= MoveStep.StoreTS16; } public bool IsPutOnOut { get => (To.posid == BoxStorePosition.rightdoor || To.posid == BoxStorePosition.leftdoor) && MoveInfo.MoveStep >= MoveStep.StoreTS16; }
public BoxTransport(Robot_Config _Config, MainMachine _mainMachine) public BoxTransport(Robot_Config _Config, MainMachine _mainMachine)
{ {
Config = _Config; Config = _Config;
mainMachine = _mainMachine; mainMachine = _mainMachine;
MoveInfo = new MoveInfo("行走机构",false); MoveInfo = new MoveInfo("行走机构", false);
#region 初始化伺服轴 #region 初始化伺服轴
XAxis = _mainMachine.XAxis; XAxis = _mainMachine.XAxis;
YAxis = _mainMachine.YAxis; YAxis = _mainMachine.YAxis;
ZAxis = _mainMachine.ZAxis; ZAxis = _mainMachine.ZAxis;
#endregion #endregion
} }
public void Reset() { public void Reset()
{
MoveInfo.NewMove(MoveStep.Wait); MoveInfo.NewMove(MoveStep.Wait);
MoveInfo.log("执行重置"); MoveInfo.log("执行重置");
} }
StoreMoveType storeMoveType = StoreMoveType.None; StoreMoveType storeMoveType = StoreMoveType.None;
string WareCode=""; string WareCode = "";
bool PreMove = false; bool PreMove = false;
public bool Start(BoxStorePosition from, BoxStorePosition to, StoreMoveType _storeMoveType, string warecode, bool premove=false) public bool Start(BoxStorePosition from, BoxStorePosition to, StoreMoveType _storeMoveType, string warecode, bool premove = false)
{ {
if (MoveInfo.MoveStep != MoveStep.Wait) if (MoveInfo.MoveStep != MoveStep.Wait)
...@@ -69,7 +71,7 @@ namespace DeviceLibrary ...@@ -69,7 +71,7 @@ namespace DeviceLibrary
MoveInfo.log($"{storeMoveType}:开始运输周转箱,从:{From.posid},到:{To.posid}"); MoveInfo.log($"{storeMoveType}:开始运输周转箱,从:{From.posid},到:{To.posid}");
} }
MoveInfo.MoveParam.WareCode = WareCode; MoveInfo.MoveParam.WareCode = WareCode;
MoveInfo.MoveParam.PosID = $"{(From==null?"None":From.posid)}=>{To.posid}"; MoveInfo.MoveParam.PosID = $"{(From == null ? "None" : From.posid)}=>{To.posid}";
ErrMsgTxt = ""; ErrMsgTxt = "";
return true; return true;
//thread = new Thread(new ThreadStart(Run)); //thread = new Thread(new ThreadStart(Run));
...@@ -106,7 +108,8 @@ namespace DeviceLibrary ...@@ -106,7 +108,8 @@ namespace DeviceLibrary
return false; return false;
} }
public bool ReadyToTakeBox() { public bool ReadyToTakeBox()
{
if (MoveInfo.MoveStep != MoveStep.StoreTS05) if (MoveInfo.MoveStep != MoveStep.StoreTS05)
return false; return false;
...@@ -127,7 +130,8 @@ namespace DeviceLibrary ...@@ -127,7 +130,8 @@ namespace DeviceLibrary
MoveInfo.log($"{storeMoveType}:等待入库料箱升降台到位"); MoveInfo.log($"{storeMoveType}:等待入库料箱升降台到位");
} }
} }
}else }
else
MoveInfo.NextMoveStep(MoveStep.StoreTS06); MoveInfo.NextMoveStep(MoveStep.StoreTS06);
return true; return true;
} }
...@@ -135,7 +139,6 @@ namespace DeviceLibrary ...@@ -135,7 +139,6 @@ namespace DeviceLibrary
{ {
if (mainMachine.CheckWait(MoveInfo)) if (mainMachine.CheckWait(MoveInfo))
return false; return false;
switch (MoveInfo.MoveStep) switch (MoveInfo.MoveStep)
{ {
case MoveStep.Wait: case MoveStep.Wait:
...@@ -171,14 +174,18 @@ namespace DeviceLibrary ...@@ -171,14 +174,18 @@ namespace DeviceLibrary
// XAxis.AbsMove(MoveInfo, Config.Xaxis_P1, Config.Xaxis_P1_speed); // XAxis.AbsMove(MoveInfo, Config.Xaxis_P1, Config.Xaxis_P1_speed);
// MoveInfo.log($"{storeMoveType}:上下轴,行走机构返回待机点P1"); // MoveInfo.log($"{storeMoveType}:上下轴,行走机构返回待机点P1");
//} //}
break;
case MoveStep.StoreTS04:
MoveInfo.NextMoveStep(MoveStep.StoreTS05);
YAxis.AbsMove(MoveInfo, From.Yaxis_PL, Config.Yaxis_P1_speed); YAxis.AbsMove(MoveInfo, From.Yaxis_PL, Config.Yaxis_P1_speed);
MoveInfo.log($"{storeMoveType}:上下轴到达取料低点"); MoveInfo.log($"{storeMoveType}:上下轴到达取料低点");
XAxis.AbsMove(MoveInfo, From.Xaxis_P2, Config.Xaxis_P2_speed); XAxis.AbsMove(MoveInfo, From.Xaxis_P2, Config.Xaxis_P2_speed);
MoveInfo.log($"{storeMoveType}:行走机构到达取料点"); MoveInfo.log($"{storeMoveType}:行走机构到达取料点");
break; break;
case MoveStep.StoreTS04:
MoveInfo.NextMoveStep(MoveStep.StoreTS05);
//YAxis.AbsMove(MoveInfo, From.Yaxis_PL, Config.Yaxis_P1_speed);
//MoveInfo.log($"{storeMoveType}:上下轴到达取料低点");
//XAxis.AbsMove(MoveInfo, From.Xaxis_P2, Config.Xaxis_P2_speed);
//MoveInfo.log($"{storeMoveType}:行走机构到达取料点");
break;
case MoveStep.StoreTS05: case MoveStep.StoreTS05:
if (!PreMove) if (!PreMove)
{ {
...@@ -238,7 +245,7 @@ namespace DeviceLibrary ...@@ -238,7 +245,7 @@ namespace DeviceLibrary
} }
else if (!IgnoreX09 && IOManager.IOValue(IO_Type.ForkMaterial_Check).Equals(IO_VALUE.LOW)) else if (!IgnoreX09 && IOManager.IOValue(IO_Type.ForkMaterial_Check).Equals(IO_VALUE.LOW))
{ {
Msg.add("出库时伸缩叉X05没有检测到有物料无法继续,请检查", MsgLevel.alarm,ErrInfo.X09_BoxNotDetect); Msg.add("出库时伸缩叉X05没有检测到有物料无法继续,请检查", MsgLevel.alarm, ErrInfo.X09_BoxNotDetect);
RobotManage.UserPause("出库时伸缩叉X05没有检测到有物料无法继续,请检查"); RobotManage.UserPause("出库时伸缩叉X05没有检测到有物料无法继续,请检查");
} }
else else
...@@ -264,7 +271,8 @@ namespace DeviceLibrary ...@@ -264,7 +271,8 @@ namespace DeviceLibrary
MoveInfo.log($"{storeMoveType}:上下轴到达目的地高点"); MoveInfo.log($"{storeMoveType}:上下轴到达目的地高点");
break; break;
case MoveStep.StoreTS11: case MoveStep.StoreTS11:
if (To.posid==BoxStorePosition.rightdoor || To.posid == BoxStorePosition.leftdoor) { if (To.posid == BoxStorePosition.rightdoor || To.posid == BoxStorePosition.leftdoor)
{
if (!InOutDevice.InOutDeviceList[To.CurrentSide].IsOutLiftEmpty) if (!InOutDevice.InOutDeviceList[To.CurrentSide].IsOutLiftEmpty)
{ {
if (MoveInfo.IsTimeOut(20)) if (MoveInfo.IsTimeOut(20))
...@@ -274,7 +282,8 @@ namespace DeviceLibrary ...@@ -274,7 +282,8 @@ namespace DeviceLibrary
MoveInfo.NextMoveStep(MoveStep.StoreTS12); MoveInfo.NextMoveStep(MoveStep.StoreTS12);
InOutDevice.InOutDeviceList[To.CurrentSide].OpenDoor(MoveInfo); InOutDevice.InOutDeviceList[To.CurrentSide].OpenDoor(MoveInfo);
return false; return false;
}else }
else
MoveInfo.NextMoveStep(MoveStep.StoreTS12); MoveInfo.NextMoveStep(MoveStep.StoreTS12);
break; break;
case MoveStep.StoreTS12: case MoveStep.StoreTS12:
...@@ -285,7 +294,7 @@ namespace DeviceLibrary ...@@ -285,7 +294,7 @@ namespace DeviceLibrary
case MoveStep.StoreTS13: case MoveStep.StoreTS13:
if (To != null) if (To != null)
GetCamera(To.Zaxis_P2).CameraGrabOne(RobotManage.CameraA.GetFixtureStateFilename(To.posid, WareCode, storeMoveType, FixtureState.ToIn)); GetCamera(To.Zaxis_P2).CameraGrabOne(RobotManage.CameraA.GetFixtureStateFilename(To.posid, WareCode, storeMoveType, FixtureState.ToIn));
if (From!=null) if (From != null)
RobotManage.CameraB.CameraGrabOne(RobotManage.CameraA.GetFixtureStateFilename(From.posid, WareCode, storeMoveType, FixtureState.ToInSide)); RobotManage.CameraB.CameraGrabOne(RobotManage.CameraA.GetFixtureStateFilename(From.posid, WareCode, storeMoveType, FixtureState.ToInSide));
MoveInfo.NextMoveStep(MoveStep.StoreTS14); MoveInfo.NextMoveStep(MoveStep.StoreTS14);
YAxis.AbsMove(MoveInfo, To.Yaxis_PL, Config.Yaxis_P4_speed); YAxis.AbsMove(MoveInfo, To.Yaxis_PL, Config.Yaxis_P4_speed);
...@@ -338,7 +347,6 @@ namespace DeviceLibrary ...@@ -338,7 +347,6 @@ namespace DeviceLibrary
MoveInfo.log($"{storeMoveType}:未找到对应步骤:{MoveInfo.MoveStep}"); MoveInfo.log($"{storeMoveType}:未找到对应步骤:{MoveInfo.MoveStep}");
return true; return true;
} }
return false; return false;
} }
private void InOutEndProcess(StoreMoveType storeMoveType, string posid) private void InOutEndProcess(StoreMoveType storeMoveType, string posid)
...@@ -346,7 +354,8 @@ namespace DeviceLibrary ...@@ -346,7 +354,8 @@ namespace DeviceLibrary
InOutEndProcessEvent?.Invoke(posid, storeMoveType, true); InOutEndProcessEvent?.Invoke(posid, storeMoveType, true);
} }
HIKCamera GetCamera(int pos) { HIKCamera GetCamera(int pos)
{
//return pos > 0 ? RobotManage.CameraA : RobotManage.CameraB; //return pos > 0 ? RobotManage.CameraA : RobotManage.CameraB;
return RobotManage.CameraA; return RobotManage.CameraA;
} }
......
...@@ -198,7 +198,7 @@ namespace DeviceLibrary ...@@ -198,7 +198,7 @@ namespace DeviceLibrary
} }
else//超重 else//超重
{ {
MoveInfo.NextMoveStep(MoveStep.Out05); MoveInfo.NextMoveStep(MoveStep.InNG1);
Lift.LiftDown(MoveInfo); Lift.LiftDown(MoveInfo);
Msg.add("周转箱超重,退出", MsgLevel.alarm); Msg.add("周转箱超重,退出", MsgLevel.alarm);
MoveInfo.log($"周转箱当前重量{weight},超重。顶升下降,出库该周转箱"); MoveInfo.log($"周转箱当前重量{weight},超重。顶升下降,出库该周转箱");
...@@ -208,7 +208,7 @@ namespace DeviceLibrary ...@@ -208,7 +208,7 @@ namespace DeviceLibrary
else else
{ {
MoveInfo.NextMoveStep(MoveStep.In10); MoveInfo.NextMoveStep(MoveStep.In10);
MoveInfo.log($"获取周转箱重量失败,重新读取"); MoveInfo.log($"{Config.WeightSensorPort}获取周转箱重量{weight}失败,重新读取");
} }
break; break;
...@@ -256,6 +256,25 @@ namespace DeviceLibrary ...@@ -256,6 +256,25 @@ namespace DeviceLibrary
MoveInfo.NewMove(MoveStep.Wait); MoveInfo.NewMove(MoveStep.Wait);
MoveInfo.log("入库线体状态重置"); MoveInfo.log("入库线体状态重置");
break; break;
case MoveStep.InNG1:
MoveInfo.NextMoveStep(MoveStep.InNG2);
Line.LineRun("work", true, 999);
MiddleStop(MoveInfo, IO_VALUE.LOW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_F_Stop_Out, IO_VALUE.HIGH));
MoveInfo.log($"线体转动");
break;
case MoveStep.InNG2:
MoveInfo.NextMoveStep(MoveStep.InNG3);
Line.LineStop("work");
MoveInfo.log($"料箱抵达出口");
Msg.add("入库周转箱超重,已退出,请处理", MsgLevel.alarm);
RobotManage.UserPause("入库周转箱超重,退出线体");
break;
case MoveStep.InNG3:
MoveInfo.NewMove(MoveStep.Wait);
MoveInfo.log("入库线体状态重置");
break;
} }
} }
......
...@@ -46,6 +46,9 @@ namespace DeviceLibrary ...@@ -46,6 +46,9 @@ namespace DeviceLibrary
InOverHead, InOverHead,
InReset, InReset,
InNG1,
InNG2,
InNG3,
OutBoxPutOn, OutBoxPutOn,
Out01, Out01,
Out02, Out02,
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!