Commit f38a5be1 刘韬

1

1 个父辈 9d5f1ef3
......@@ -341,7 +341,7 @@ namespace DeviceLibrary
#region 匀速上升处理
private System.Timers.Timer axisCheckTimer = null;
internal string[] TargetIoType = new string[] { };
internal IO_VALUE TargetIoValue = IO_VALUE.HIGH;
internal volatile IO_VALUE TargetIoValue = IO_VALUE.HIGH;
public bool BatchAxisStartCheck(string[] targetIo, IO_VALUE value = IO_VALUE.HIGH)
{
if (axisCheckTimer == null)
......@@ -365,6 +365,7 @@ namespace DeviceLibrary
{
axisCheckTimer.Stop();
}
TargetIoValue = IO_VALUE.None;
return true;
}
private bool IsInProcess = false;
......@@ -378,9 +379,9 @@ namespace DeviceLibrary
{
if (IOManager.IOValue(io).Equals(TargetIoValue))
{
SuddenStop();
StopAxisCheckMove();
SuddenStop();
LogUtil.info(AxisName + "上料轴,检测到 " + io + "=" + TargetIoValue + ",停止运动");
StopAxisCheckMove();
break;
}
}
......
......@@ -61,6 +61,7 @@ namespace DeviceLibrary
print.LoadLabel(labelname);
var bmp = print.PrintPreview(data);
//print.Print(data);
if (!zebraManger.PrintImage(bmp, out msg))
{
LogUtil.error(msg);
......
......@@ -122,37 +122,46 @@ namespace DeviceLibrary
else if (wait.WaitType.Equals(WaitEnum.W008_BatchAxis))
{
AxisBean axisBean = AxisBean.List.Find(a => a.Config.GetAxisValue() == wait.AxisInfo.GetAxisValue());
//等待信号亮或者走到绝对位置才停止
var tio = axisBean.TargetIoType.Where(io => { return IOValue(io).Equals(axisBean.TargetIoValue); });
if (tio.Count()>0)
if (axisBean.TargetIoValue == IO_VALUE.None)
{
LogUtil.info(Name + "CheckWaitResult 检测到" + string.Join(",",tio.ToArray()) + "=" + axisBean.TargetIoValue + ",停止运行");
axisBean.StopAxisCheckMove();
if (AxisManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(1))
{
axisBean.SuddenStop();
}
wait.IsEnd = true;
axisBean.SuddenStop();
LogUtil.info(Name + "axisCheckTimer 已经结束,停止运行");
}
else
{
bool isbusy = AxisManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(1);
if (!isbusy)
//等待信号亮或者走到绝对位置才停止
var tio = axisBean.TargetIoType.Where(io => { return IOValue(io).Equals(axisBean.TargetIoValue); });
if (tio.Count() > 0)
{
int outCount = AxisManager.GetActualtPosition(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
LogUtil.info($"{wait.AxisInfo.Explain},当前位置:{outCount}");
int errorCount = Math.Abs(outCount - wait.TargetPosition);
if (errorCount <= wait.AxisInfo.CanErrorCountMax)
LogUtil.info(Name + "CheckWaitResult 检测到" + string.Join(",", tio.ToArray()) + "=" + axisBean.TargetIoValue + ",停止运行");
axisBean.StopAxisCheckMove();
if (AxisManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(1))
{
LogUtil.info($"{wait.AxisInfo.Explain},到达目标:errorCount:{errorCount},停止上升");
axisBean.StopAxisCheckMove();
wait.IsEnd = true;
axisBean.SuddenStop();
}
else
wait.IsEnd = true;
}
else
{
bool isbusy = AxisManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(1);
if (!isbusy && axisBean.TargetIoValue != IO_VALUE.None)
{
LogUtil.info($"{wait.AxisInfo.Explain},继续上升:{wait.TargetPosition}");
axisBean.AbsMove(null, wait.TargetPosition, wait.TargetSpeed);
wait.IsEnd = false;
int outCount = AxisManager.GetActualtPosition(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue());
LogUtil.info($"{wait.AxisInfo.Explain},当前位置:{outCount}");
int errorCount = Math.Abs(outCount - wait.TargetPosition);
if (errorCount <= wait.AxisInfo.CanErrorCountMax)
{
LogUtil.info($"{wait.AxisInfo.Explain},到达目标:errorCount:{errorCount},停止上升");
axisBean.StopAxisCheckMove();
wait.IsEnd = true;
}
else
{
LogUtil.info($"{wait.AxisInfo.Explain},继续上升:{wait.TargetPosition}");
axisBean.AbsMove(null, wait.TargetPosition, wait.TargetSpeed);
wait.IsEnd = false;
}
}
}
}
......
......@@ -358,7 +358,7 @@ namespace DeviceLibrary
ResetMoveInfo.log("小车批量轴, 贴标z轴回原");
Loading_Batch_Axis.HomeMove(null, forceHome);
Unloading_Batch_Axis.HomeMove(null, forceHome);
Label_Z_Axis.HomeMove(ResetMoveInfo, forceHome);
Label_Z_Axis.HomeMove(null, forceHome);
GrabImageEX();
break;
case MoveStep.H02_HomeReset_02:
......@@ -366,6 +366,7 @@ namespace DeviceLibrary
ResetMoveInfo.log("2侧升降轴回原");
Loading_UpDown_Axis.HomeMove(ResetMoveInfo, forceHome);
Unloading_UpDown_Axis.HomeMove(ResetMoveInfo, forceHome);
Label_Z_Axis.HomeMove(ResetMoveInfo, forceHome);
break;
case MoveStep.H02_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H02_HomeReset_1);
......@@ -387,13 +388,15 @@ namespace DeviceLibrary
case MoveStep.H03_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H04_HomeReset);
ResetMoveInfo.log("2侧旋转轴回原");
Loading_Middle_Axis.HomeMove(ResetMoveInfo, forceHome);
Unloading_Middle_Axis.HomeMove(ResetMoveInfo, forceHome);
Loading_Middle_Axis.HomeMove(null, forceHome);
Unloading_Middle_Axis.HomeMove(null, forceHome);
break;
case MoveStep.H04_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H05_HomeReset);
Loading_Batch_Axis.HomeMove(ResetMoveInfo, forceHome);
Unloading_Batch_Axis.HomeMove(ResetMoveInfo, forceHome);
Loading_Middle_Axis.HomeMove(ResetMoveInfo, forceHome);
Unloading_Middle_Axis.HomeMove(ResetMoveInfo, forceHome);
break;
case MoveStep.H05_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H06_HomeReset);
......
......@@ -271,13 +271,13 @@ namespace DeviceLibrary
CountMoveInfo.log("料盘已取走");
break;
case MoveStep.Count_20:
if (IOValue(IO_Type.Counting_ExitDoor_Close).Equals(IO_VALUE.HIGH) || OutMoveInfo.MoveStep>= MoveStep.Out_03)
if (OutMoveInfo.MoveStep>= MoveStep.Out_09)
{
CountMoveInfo.NextMoveStep(MoveStep.Count_21);
CountMoveInfo.log("出口门已关闭");
CountMoveInfo.log("料盘已取走");
}
else if (CountMoveInfo.IsTimeOut(60)) {
CountMoveInfo.log("等待出口门关闭");
CountMoveInfo.log("等待料盘取走超时");
}
break;
case MoveStep.Count_21:
......
......@@ -130,7 +130,7 @@ namespace DeviceLibrary
InMoveInfo.log($"旋转轴到达p1点,升降轴到放料P2");
break;
case MoveStep.In_11:
if (CountMoveInfo.MoveStep == MoveStep.Wait)
if (CountMoveInfo.MoveStep == MoveStep.Wait || IOValue(IO_Type.Counting_EnterDoor_Open).Equals(IO_VALUE.HIGH))
{
InMoveInfo.NextMoveStep(MoveStep.In_12);
InMoveInfo.log($"点料机已空闲");
......@@ -151,9 +151,16 @@ namespace DeviceLibrary
InMoveInfo.log($"旋转轴,升降轴到达放料p2点");
break;
case MoveStep.In_14:
InMoveInfo.NextMoveStep(MoveStep.In_15);
Loading_InOut_Axis.AbsMove(InMoveInfo, InToPos.InOut_P2, Config.Loading_InOut_Axis_P1_speed);
InMoveInfo.log($"进出轴达放料p2点");
if (CountMoveInfo.MoveStep == MoveStep.Wait)
{
InMoveInfo.NextMoveStep(MoveStep.In_15);
Loading_InOut_Axis.AbsMove(InMoveInfo, InToPos.InOut_P2, Config.Loading_InOut_Axis_P1_speed);
InMoveInfo.log($"进出轴达放料p2点");
}
else
{
Msg.add("等待点料机空闲", MsgLevel.info);
}
break;
case MoveStep.In_15:
if (IOValue(IO_Type.Counting_Reel_Check).Equals(IO_VALUE.LOW))
......@@ -174,7 +181,7 @@ namespace DeviceLibrary
case MoveStep.In_16:
InMoveInfo.NextMoveStep(MoveStep.In_17);
IOMove(IO_Type.Loading_ReelVacuum_On, IO_VALUE.LOW);
InMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(500));
InMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
InMoveInfo.log($"关闭吸盘");
break;
case MoveStep.In_17:
......
......@@ -64,9 +64,18 @@ namespace DeviceLibrary
else
OutCarType = CarTypeE.Car13;
OutCarMoveInfo.log($"检测到料车尺寸:{InCarType}");
OutCarMoveInfo.NextMoveStep(MoveStep.OutCar_03);
Unloading_NOCar_Led.LedState = LedState.on;
if (InCarType != CarTypeE.None && InCarType != OutCarType)
{
OutCarMoveInfo.NextMoveStep(MoveStep.OutCarOut_01);
OutCarMoveInfo.log("检测到出料车与入料车尺寸不符");
}
else
{
OutCarMoveInfo.log($"检测到料车尺寸:{OutCarType}");
OutCarMoveInfo.NextMoveStep(MoveStep.OutCar_03);
Unloading_NOCar_Led.LedState = LedState.on;
}
}
else {
OutCarMoveInfo.log($"小车丢失,重新检测");
......@@ -86,7 +95,7 @@ namespace DeviceLibrary
if (lowlist.Length > 0)
{
OutCarMoveInfo.log($"批量轴高速上升到顶部检测点");
BatchAxisToP2(OutCarMoveInfo, Unloading_Batch_Axis, OutGetLowReelCheckIOList(), IO_VALUE.HIGH, Config.Unloading_Batch_Axis_P2, Config.Unloading_Batch_Axis_P1_speed);
BatchAxisToP2(OutCarMoveInfo, Unloading_Batch_Axis, lowlist, IO_VALUE.HIGH, Config.Unloading_Batch_Axis_P2, Config.Unloading_Batch_Axis_P1_speed);
}
else {
OutCarMoveInfo.log($"批量轴所有监测点都已Low");
......
......@@ -51,9 +51,13 @@ namespace DeviceLibrary
}
break;
case MoveStep.Out_01:
OutMoveInfo.NextMoveStep(MoveStep.Out_02);
OutMoveInfo.NextMoveStep(MoveStep.Out_03);
Unloading_InOut_Axis.AbsMove(OutMoveInfo, Config.Unloading_InOut_Axis_P1, Config.Unloading_InOut_Axis_P1_speed);
OutMoveInfo.log($"进出轴回到p1");
CylinderMove(OutMoveInfo, IO_Type.Counting_ExitDoor_Close, IO_Type.Counting_ExitDoor_Open, IO_VALUE.HIGH);
if (InMoveInfo.MoveStep>=MoveStep.In_10 && InMoveInfo.MoveStep <= MoveStep.In_13)
CylinderMove(null, IO_Type.Counting_EnterDoor_Close, IO_Type.Counting_EnterDoor_Open, IO_VALUE.HIGH);
OutMoveInfo.log($"打开点料机出口大门");
break;
case MoveStep.Out_02:
OutMoveInfo.NextMoveStep(MoveStep.Out_03);
......@@ -120,6 +124,8 @@ namespace DeviceLibrary
break;
case MoveStep.Out_09:
OutMoveInfo.NextMoveStep(MoveStep.Out_10);
if (CountMoveInfo.MoveStep == MoveStep.Count_ReadyOut)
CountMoveInfo.NextMoveStep(MoveStep.Count_Outted);
Unloading_Middle_Axis.AbsMove(OutMoveInfo, Config.Unloading_Middle_Axis_P1, Config.Unloading_Middle_Axis_P1_speed);
Unloading_UpDown_Axis.AbsMove(OutMoveInfo, Config.Unloading_UpDown_Axis_P1, Config.Unloading_UpDown_Axis_P1_speed);
OutMoveInfo.log($"旋转轴, 升降轴到p1");
......@@ -131,8 +137,7 @@ namespace DeviceLibrary
if (OutMoveInfo.MoveParam.IsNg)
OutMoveInfo.NextMoveStep(MoveStep.Out_20);
if (CountMoveInfo.MoveStep == MoveStep.Count_ReadyOut)
CountMoveInfo.NextMoveStep(MoveStep.Count_Outted);
break;
case MoveStep.Out_11:
if (string.IsNullOrEmpty(OutMoveInfo.MoveParam.ReeID)) {
......@@ -197,7 +202,7 @@ namespace DeviceLibrary
}
}
else if (OutCarMoveInfo.MoveStep == MoveStep.OutCarReadyPut)
else if (OutCarMoveInfo.MoveStep == MoveStep.OutCarReadyPut && (InCarType == OutCarType || InCarType== CarTypeE.None))
{
OutMoveInfo.MoveParam.CurrentStringNum = OutCurrentStringNum;
var topos = "Unloading_T" + OutCurrentStringNum;
......@@ -207,7 +212,12 @@ namespace DeviceLibrary
Unloading_UpDown_Axis.AbsMove(OutMoveInfo, OutToPos.UpDown_P2, Config.Unloading_UpDown_Axis_P1_speed);
OutMoveInfo.log($"旋转轴,升降轴到达p2点");
}
else {
else if (InCarType != OutCarType) {
Msg.add("出料车尺寸与入料车不符", MsgLevel.alarm);
LogUtil.info("出料车尺寸与入料车不符");
}
else
{
Msg.add("等待出口料车可以放料", MsgLevel.info);
LogUtil.info("等待出口料车可以放料");
}
......@@ -215,7 +225,7 @@ namespace DeviceLibrary
case MoveStep.Out_21:
OutMoveInfo.NextMoveStep(MoveStep.Out_22);
Unloading_InOut_Axis.AbsMove(OutMoveInfo, OutToPos.InOut_P2, Config.Unloading_InOut_Axis_P1_speed);
OutMoveInfo.log($"进出轴达p2点");
OutMoveInfo.log($"进出轴达p2点");
break;
case MoveStep.Out_22:
OutMoveInfo.NextMoveStep(MoveStep.Out_23);
......@@ -277,8 +287,10 @@ namespace DeviceLibrary
break;
case MoveStep.Out_30:
OutMoveInfo.NextMoveStep(MoveStep.Out_31);
BatchAxisToP2(OutMoveInfo, Unloading_Batch_Axis, OutGetReelCheckIOList(OutCurrentStringNum), IO_VALUE.HIGH, Config.Unloading_Batch_Axis_P2, Config.Unloading_Batch_Axis_P2_speed);
OutMoveInfo.log($"批量轴慢速上升到检测点亮");
var target = Unloading_Batch_Axis.GetAclPosition();
target = target + (OutMoveInfo.MoveParam.PlateH +20) * 1000;
BatchAxisToP2(OutMoveInfo, Unloading_Batch_Axis, OutGetReelCheckIOList(OutCurrentStringNum), IO_VALUE.HIGH, target, Config.Unloading_Batch_Axis_P2_speed);
OutMoveInfo.log($"批量轴慢速上升到检测点亮,当前位置:{Unloading_Batch_Axis.GetAclPosition()},控制上升:{OutMoveInfo.MoveParam.PlateH},{target}");
break;
case MoveStep.Out_31:
OutMoveInfo.NextMoveStep(MoveStep.Out_WaitForLabel);
......

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
# Visual Studio Version 17
VisualStudioVersion = 17.9.34701.34
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "LoadCVSLibrary\LoadCSVLibrary.csproj", "{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}"
EndProject
......
......@@ -344,6 +344,14 @@ namespace TheMachine
lm.Add(m);
}
SetMsg(lm);
foreach (var cn in pnl.Controls)
{
if (cn is CylinderButton)
{
(cn as CylinderButton).DataUpdate();
}
}
}
private void MainMachine_ButtenEvent(object sender, ErrInfo e)
......
......@@ -84,7 +84,7 @@ namespace TheMachine
Environment.CurrentDirectory = Application.StartupPath;
XmlConfigurator.Configure();
var pn = ServerCommunication.GetPnByReelid("123");
//var pn= ServerCommunication.GetPnByReelid("S202306181351530002");
//LogUtil.info(pn);
//return;
......
......@@ -82,7 +82,9 @@ namespace TheMachine
}
}
void DataUpdate() {
[Category("数据"), Description("需要确认"), Browsable(true)]
public bool Confirm{get;set;}=false;
public void DataUpdate() {
if (string.IsNullOrEmpty(io_high) || !DeviceConfig.AllDOlist.ContainsKey(io_high))
this.Text = $"IO {io_high} Not Find";
else
......@@ -111,6 +113,9 @@ namespace TheMachine
}
void StateUpdate()
{
if (configio_high == null)
return;
io_state = IOManager.GetDOValue(configio_high.DeviceName, configio_high.SlaveID, configio_high.GetIOAddr());
if (configio_low != null)
{
......@@ -142,6 +147,18 @@ namespace TheMachine
}
private void CylinderButton_Click(object sender, EventArgs e)
{
if (Confirm) {
if (RobotManage.isRunning) {
MessageBox.Show($"设备正在运行,不能操作IO");
return;
}
var r = MessageBox.Show($"您正在点击:{Text}", "请注意", MessageBoxButtons.OKCancel);
if (r != DialogResult.OK) {
return;
}
}
if (io_state.Equals(IO_VALUE.LOW))
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!