Commit cf9f0446 刘韬

1

1 个父辈 1243deb9
...@@ -338,7 +338,7 @@ namespace DeviceLibrary ...@@ -338,7 +338,7 @@ namespace DeviceLibrary
{ {
axisCheckTimer = new System.Timers.Timer(); axisCheckTimer = new System.Timers.Timer();
axisCheckTimer.AutoReset = true; axisCheckTimer.AutoReset = true;
axisCheckTimer.Interval += 30; axisCheckTimer.Interval += 15;
axisCheckTimer.Elapsed += CheckTimer_Elapsed; axisCheckTimer.Elapsed += CheckTimer_Elapsed;
axisCheckTimer.Enabled = false; axisCheckTimer.Enabled = false;
} }
......
...@@ -103,12 +103,16 @@ namespace DeviceLibrary ...@@ -103,12 +103,16 @@ namespace DeviceLibrary
{ {
operation.data.Add("singleIn", "false"); operation.data.Add("singleIn", "false");
} }
int retrytimes = 0;
retry:
Operation resultOperation = HttpHelper.Post(GetPostApi(), operation, 15000, printlog); Operation resultOperation = HttpHelper.Post(GetPostApi(), operation, 15000, printlog);
if (resultOperation==null || operation.seq != resultOperation.seq) if (RobotManage.isRunning &&( resultOperation==null || operation.seq != resultOperation.seq))
{ {
Thread.Sleep(1000); Thread.Sleep(1000);
SendInStoreRequest(codelist, reel, printlog); //SendInStoreRequest(codelist, reel, printlog);
return; retrytimes++;
if (retrytimes <= 3)
goto retry;
} }
ResultProcess(resultOperation); ResultProcess(resultOperation);
} }
......
...@@ -173,6 +173,11 @@ namespace DeviceLibrary ...@@ -173,6 +173,11 @@ namespace DeviceLibrary
{ {
RobotManage.mainMachine.CylinderMove(MoveInfo, IO_Type.Clamping_Relax, IO_Type.Clamping_Work, IO_VALUE.LOW); RobotManage.mainMachine.CylinderMove(MoveInfo, IO_Type.Clamping_Relax, IO_Type.Clamping_Work, IO_VALUE.LOW);
} }
else {
MoveInfo.NextMoveStep(MoveStep.StoreTS08);
UpDown_Axis.AbsMove(MoveInfo, From.UpDown_PH, Config.UpDown_P4_speed);
MoveInfo.log($"{storeMoveType}:上下轴到达取料高点");
}
break; break;
case MoveStep.StoreTS07: case MoveStep.StoreTS07:
MoveInfo.NextMoveStep(MoveStep.StoreTS08); MoveInfo.NextMoveStep(MoveStep.StoreTS08);
......
...@@ -22,6 +22,7 @@ namespace DeviceLibrary ...@@ -22,6 +22,7 @@ namespace DeviceLibrary
if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.HIGH))
{ {
Msg.add(crc.GetString(L.reset_press, "按下复位按钮."), MsgLevel.info, ErrInfo.ResetBtn); Msg.add(crc.GetString(L.reset_press, "按下复位按钮."), MsgLevel.info, ErrInfo.ResetBtn);
ButtenEvent?.Invoke(null, ErrInfo.ResetBtn);
} }
else else
{ {
...@@ -41,7 +42,10 @@ namespace DeviceLibrary ...@@ -41,7 +42,10 @@ namespace DeviceLibrary
if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.HIGH))
{ {
if (!RobotManage.isRunning) if (!RobotManage.isRunning)
{
Msg.add(crc.GetString(L.runbtn_press, "按下启动按钮,开始启动."), MsgLevel.info, ErrInfo.RunBtn); Msg.add(crc.GetString(L.runbtn_press, "按下启动按钮,开始启动."), MsgLevel.info, ErrInfo.RunBtn);
ButtenEvent?.Invoke(null, ErrInfo.RunBtn);
}
else else
Msg.add(crc.GetString(L.system_is_running, "系统正在运行."), MsgLevel.info); Msg.add(crc.GetString(L.system_is_running, "系统正在运行."), MsgLevel.info);
} }
......
...@@ -44,7 +44,7 @@ namespace DeviceLibrary ...@@ -44,7 +44,7 @@ namespace DeviceLibrary
public delegate void ProcessMsg(List<Msg> msg); public delegate void ProcessMsg(List<Msg> msg);
public event ProcessMsg ProcessMsgEvent; public event ProcessMsg ProcessMsgEvent;
public event EventHandler<ErrInfo> ButtenEvent;
internal AxisBean Middle_Axis; internal AxisBean Middle_Axis;
public AxisBean UpDown_Axis; public AxisBean UpDown_Axis;
internal AxisBean InOut_Axis; internal AxisBean InOut_Axis;
...@@ -323,6 +323,7 @@ namespace DeviceLibrary ...@@ -323,6 +323,7 @@ namespace DeviceLibrary
ResetMoveInfo.log("旋转轴,升降轴,到P1待机点"); ResetMoveInfo.log("旋转轴,升降轴,到P1待机点");
Middle_Axis.AbsMove(ResetMoveInfo, Config.Middle_P1, Config.Middle_P1_speed); Middle_Axis.AbsMove(ResetMoveInfo, Config.Middle_P1, Config.Middle_P1_speed);
UpDown_Axis.AbsMove(ResetMoveInfo, Config.UpDown_P1, Config.UpDown_P1_speed); UpDown_Axis.AbsMove(ResetMoveInfo, Config.UpDown_P1, Config.UpDown_P1_speed);
Batch_Axis.AbsMove(ResetMoveInfo, Config.Batch_P1, Config.Batch_P1_speed);
break; break;
case MoveStep.H06_HomeReset: case MoveStep.H06_HomeReset:
ResetMoveInfo.log("压紧轴回原"); ResetMoveInfo.log("压紧轴回原");
...@@ -380,19 +381,20 @@ namespace DeviceLibrary ...@@ -380,19 +381,20 @@ namespace DeviceLibrary
break; break;
case MoveStep.H11_HomeReset: case MoveStep.H11_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H12_HomeReset); ResetMoveInfo.NextMoveStep(MoveStep.H12_HomeReset);
UpDown_Axis.AbsMove(ResetMoveInfo, Config.UpDown_P3, Config.UpDown_P3_speed);
break; break;
case MoveStep.H12_HomeReset: case MoveStep.H12_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H13_HomeReset); ResetMoveInfo.NextMoveStep(MoveStep.H13_HomeReset);
ResetMoveInfo.log("打开NG口门"); ResetMoveInfo.log("打开NG口门");
//CylinderMove(null, IO_Type.NGDoor_Close, IO_Type.NGDoor_Open, IO_VALUE.HIGH); //CylinderMove(null, IO_Type.NGDoor_Close, IO_Type.NGDoor_Open, IO_VALUE.HIGH);
SingleDoor.ToHigh(null); SingleDoor.ToHigh(ResetMoveInfo);
break; break;
case MoveStep.H13_HomeReset: case MoveStep.H13_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H14_HomeReset); ResetMoveInfo.NextMoveStep(MoveStep.H14_HomeReset);
if (!NGDoor_Tray_Test_Reel) if (!NGDoor_Tray_Test_Reel)
{ {
Msg.add(crc.GetString(L.x29_low_no_reel, "传感器X23未检测到单料口料盘."), MsgLevel.alarm); Msg.add("传感器X20未检测到单料口料盘.", MsgLevel.alarm);
RobotManage.UserPause("传感器X23未检测到单料口料盘."); RobotManage.UserPause("传感器X20未检测到单料口料盘.");
} }
//CylinderMove(ResetMoveInfo, IO_Type.NGDoor_Close, IO_Type.NGDoor_Open, IO_VALUE.HIGH); //CylinderMove(ResetMoveInfo, IO_Type.NGDoor_Close, IO_Type.NGDoor_Open, IO_VALUE.HIGH);
SingleDoor.ToHigh(ResetMoveInfo); SingleDoor.ToHigh(ResetMoveInfo);
...@@ -546,6 +548,7 @@ namespace DeviceLibrary ...@@ -546,6 +548,7 @@ namespace DeviceLibrary
//else //else
{ {
Msg.add(crc.GetString(L.system_need_reset, "系统需要重置"), MsgLevel.alarm,ErrInfo.SuddenStop); Msg.add(crc.GetString(L.system_need_reset, "系统需要重置"), MsgLevel.alarm,ErrInfo.SuddenStop);
ButtenEvent?.Invoke(null, ErrInfo.SuddenStop);
ok = false; ok = false;
} }
} }
...@@ -595,6 +598,7 @@ namespace DeviceLibrary ...@@ -595,6 +598,7 @@ namespace DeviceLibrary
{ {
Msg.add(crc.GetString(configMoveAxis.ProName, configMoveAxis.Explain) + $"[{configMoveAxis.GetAxisValue()}]:" Msg.add(crc.GetString(configMoveAxis.ProName, configMoveAxis.Explain) + $"[{configMoveAxis.GetAxisValue()}]:"
+ crc.GetString(L.motion_alarm, "运动报警"), MsgLevel.alarm, ErrInfo.SuddenStop); + crc.GetString(L.motion_alarm, "运动报警"), MsgLevel.alarm, ErrInfo.SuddenStop);
ButtenEvent?.Invoke(null, ErrInfo.SuddenStop);
} }
......
...@@ -120,7 +120,7 @@ namespace DeviceLibrary ...@@ -120,7 +120,7 @@ namespace DeviceLibrary
ClampMoveInfo.MoveParam.NgMsg = crc.GetString(L.not_detect_reel_height, "未检测到盘宽"); ClampMoveInfo.MoveParam.NgMsg = crc.GetString(L.not_detect_reel_height, "未检测到盘宽");
ClampMoveInfo.log($"未检测到盘宽"); ClampMoveInfo.log($"未检测到盘宽");
ReelGetted(false); ReelGetted(false);
ClampMoveInfo.NextMoveStep(MoveStep.Wait); ClampMoveInfo.NextMoveStep(MoveStep.NGOUT_08);
SingleDoor.ToHigh(ClampMoveInfo); SingleDoor.ToHigh(ClampMoveInfo);
Msg.add(ClampMoveInfo.MoveParam.NgMsg, MsgLevel.alarm); Msg.add(ClampMoveInfo.MoveParam.NgMsg, MsgLevel.alarm);
RobotManage.UserPause("未检测到盘", true); RobotManage.UserPause("未检测到盘", true);
...@@ -212,12 +212,14 @@ namespace DeviceLibrary ...@@ -212,12 +212,14 @@ namespace DeviceLibrary
} }
break; break;
case MoveStep.NGOUT_08: case MoveStep.NGOUT_08:
Msg.add(ClampMoveInfo.MoveParam.NgMsg, MsgLevel.warning);
if (IOValue(IO_Type.SafetyLightCurtains).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.SafetyLightCurtains).Equals(IO_VALUE.LOW))
{ {
Msg.add(crc.GetString(L.wait_put_reel_into_ngdoor, "等待阻挡物离开光栅"), MsgLevel.warning); Msg.add(crc.GetString(L.wait_put_reel_into_ngdoor, "等待阻挡物离开光栅"), MsgLevel.warning);
}else if (IOValue(IO_Type.NGDoor_Close).Equals(IO_VALUE.LOW)) }else if (IOValue(IO_Type.NGDoor_Close).Equals(IO_VALUE.LOW))
{ {
Msg.add(crc.GetString(L.wait_ngdoor_close, "等待单料门关闭"), MsgLevel.warning); Msg.add(crc.GetString(L.wait_ngdoor_close, "等待单料门关闭"), MsgLevel.warning);
} }
else else
{ {
......
...@@ -121,7 +121,7 @@ namespace DeviceLibrary ...@@ -121,7 +121,7 @@ namespace DeviceLibrary
Msg.add(crc.GetString(L.out_store_free, "舱内有出库料盘"), MsgLevel.warning);//0704 Msg.add(crc.GetString(L.out_store_free, "舱内有出库料盘"), MsgLevel.warning);//0704
} }
if (StringState < StringStateE.Full && StoreMoveInfo.MoveStep >= MoveStep.StoreOut10 && IsBatchDoorClosed) if (StringState < StringStateE.Full && StoreMoveInfo.MoveStep >= MoveStep.StoreOut10 && !StoreMoveInfo.MoveParam.IsNg && IsBatchDoorClosed)
{ {
StringMoveInfo.NextMoveStep(MoveStep.StringLoad_01); StringMoveInfo.NextMoveStep(MoveStep.StringLoad_01);
StringState = StringStateE.OutStore; StringState = StringStateE.OutStore;
...@@ -137,18 +137,31 @@ namespace DeviceLibrary ...@@ -137,18 +137,31 @@ namespace DeviceLibrary
StringMoveInfo.NextMoveStep(MoveStep.StringLoad_02); StringMoveInfo.NextMoveStep(MoveStep.StringLoad_02);
break; break;
case MoveStep.StringLoad_02: case MoveStep.StringLoad_02:
StringMoveInfo.NextMoveStep(MoveStep.StringLoad_03); StringMoveInfo.NextMoveStep(MoveStep.StringLoad_02a);
newreel = true; newreel = true;
downCheck1 = false; downCheck1 = false;
downCheck2 = false; downCheck2 = false;
downCheck3 = false; downCheck3 = false;
break; break;
case MoveStep.StringLoad_02a:
StringMoveInfo.NextMoveStep(MoveStep.StringLoad_02b);
StringMoveInfo.log($"批量轴高速上升到顶部检测点");
BatchAxisToP2(StringMoveInfo, true);
break;
case MoveStep.StringLoad_02b:
StringMoveInfo.NextMoveStep(MoveStep.StringLoad_03);
var tpos1 = Batch_Axis.GetAclPosition() - Config.Batch_PoToMM * 10;
if (tpos1 < 0)
tpos1 = 0;
Batch_Axis.AbsMove(StringMoveInfo, tpos1, Config.Batch_P1_speed);
StringMoveInfo.log($"批量轴下降1cm");
break;
case MoveStep.StringLoad_03: case MoveStep.StringLoad_03:
StringMoveInfo.NextMoveStep(MoveStep.StringLoad_04); StringMoveInfo.NextMoveStep(MoveStep.StringLoad_04);
if (oldtestheight || newreel) if (oldtestheight)
{ {
StringMoveInfo.log($"批量轴到顶部检测点"); StringMoveInfo.log($"批量轴到顶部检测点");
BatchAxisToP2(StringMoveInfo, newreel); BatchAxisToP2(StringMoveInfo);
TestHeightTask = null; TestHeightTask = null;
} }
else { else {
...@@ -205,19 +218,19 @@ namespace DeviceLibrary ...@@ -205,19 +218,19 @@ namespace DeviceLibrary
{ {
StringMoveInfo.NextMoveStep(MoveStep.StringReadyPut); StringMoveInfo.NextMoveStep(MoveStep.StringReadyPut);
var tpos2 = Batch_Axis.GetAclPosition() - Config.Batch_PoToMM * Config.Batch_OutStoreDownMM; var tpos3 = Batch_Axis.GetAclPosition() - Config.Batch_PoToMM * Config.Batch_OutStoreDownMM;
if (tpos2 < 0) if (tpos3 < 0)
{ {
tpos2 = 0; tpos3 = 0;
} }
StringMoveInfo.log($"料串出库模式,下降{Config.Batch_OutStoreDownMM}mm,{tpos2},{Batch_Axis.GetAclPosition()}"); StringMoveInfo.log($"料串出库模式,下降{Config.Batch_OutStoreDownMM}mm,{tpos3},{Batch_Axis.GetAclPosition()}");
if (tpos2 < Config.Batch_P1) if (tpos3 < Config.Batch_P1)
{ {
StringMoveInfo.NextMoveStep(MoveStep.StringOut_01); StringMoveInfo.NextMoveStep(MoveStep.StringOut_01);
StringState = StringStateE.Full; StringState = StringStateE.Full;
StringMoveInfo.log($"料串已满,无法出库,开始送出"); StringMoveInfo.log($"料串已满,无法出库,开始送出");
} }
Batch_Axis.AbsMove(StringMoveInfo, tpos2, Config.Batch_P1_speed); Batch_Axis.AbsMove(StringMoveInfo, tpos3, Config.Batch_P1_speed);
} }
break; break;
case MoveStep.StringLoad_07: case MoveStep.StringLoad_07:
...@@ -272,10 +285,10 @@ namespace DeviceLibrary ...@@ -272,10 +285,10 @@ namespace DeviceLibrary
StringMoveInfo.log($"料盘取走失败,料盘下降"); StringMoveInfo.log($"料盘取走失败,料盘下降");
ReelGetFail++; ReelGetFail++;
StringMoveInfo.NextMoveStep(MoveStep.StringReelGetFail_02); StringMoveInfo.NextMoveStep(MoveStep.StringReelGetFail_02);
var tpos1 = Batch_Axis.GetAclPosition() - Config.Batch_PoToMM * 20; var tpos2 = Batch_Axis.GetAclPosition() - Config.Batch_PoToMM * 20;
if (tpos1 < 0) if (tpos2 < 0)
tpos1 = 0; tpos2 = 0;
Batch_Axis.AbsMove(StringMoveInfo, tpos1, Config.Batch_P1_speed); Batch_Axis.AbsMove(StringMoveInfo, tpos2, Config.Batch_P1_speed);
break; break;
case MoveStep.StringReelGetFail_02: case MoveStep.StringReelGetFail_02:
StringMoveInfo.log($"料盘取走失败,重新上升"); StringMoveInfo.log($"料盘取走失败,重新上升");
......
...@@ -35,6 +35,8 @@ namespace DeviceLibrary ...@@ -35,6 +35,8 @@ namespace DeviceLibrary
StringLoad_01, StringLoad_01,
StringLoad_01a, StringLoad_01a,
StringLoad_02, StringLoad_02,
StringLoad_02a,
StringLoad_02b,
StringLoad_03, StringLoad_03,
StringLoad_04, StringLoad_04,
StringLoad_05, StringLoad_05,
......
...@@ -300,9 +300,14 @@ namespace TheMachine ...@@ -300,9 +300,14 @@ namespace TheMachine
pnl.Enabled = true; pnl.Enabled = true;
if (state) if (state)
{ {
btn_run.Enabled = true;
//btn_stop.Enabled = true; //btn_stop.Enabled = true;
if (!btn_run.Enabled)
{
RobotManage.mainMachine.ProcessMsgEvent += MainMachine_ProcessMsgEvent; RobotManage.mainMachine.ProcessMsgEvent += MainMachine_ProcessMsgEvent;
RobotManage.mainMachine.ButtenEvent += MainMachine_ButtenEvent;
}
btn_run.Enabled = true;
} }
ioc.Config = RobotManage.Config; ioc.Config = RobotManage.Config;
...@@ -318,6 +323,39 @@ namespace TheMachine ...@@ -318,6 +323,39 @@ namespace TheMachine
} }
SetMsg(lm); SetMsg(lm);
} }
private void MainMachine_ButtenEvent(object sender, ErrInfo e)
{
LogUtil.info("UI " + e.ToString());
if (e == ErrInfo.RunBtn)
{
Task.Run(() => {
if (!RobotManage.isRunning)
{
LogUtil.info("Task.Run");
this.Invoke((EventHandler)delegate
{
LogUtil.info("Invoke((EventHandler)delegate");
btn_run_Click(this, EventArgs.Empty);
});
}
});
}
else if (e == ErrInfo.SuddenStop)
{
Task.Run(() => {
if (RobotManage.isRunning)
this.Invoke((EventHandler)delegate
{
btn_stop_Click(this, EventArgs.Empty);
});
});
}
}
void SetMsg(List<Msg> msgs) void SetMsg(List<Msg> msgs)
{ {
this.SuspendLayout(); this.SuspendLayout();
...@@ -348,31 +386,8 @@ namespace TheMachine ...@@ -348,31 +386,8 @@ namespace TheMachine
{ {
btn_IgnoreX09.Visible = false; btn_IgnoreX09.Visible = false;
} }
else if (msg.errInfo == ErrInfo.RunBtn)
{
Task.Run(()=> {
if (!RobotManage.isRunning)
{
this.Invoke((EventHandler)delegate
{
btn_run_Click(this, EventArgs.Empty);
});
}
});
}
else if (msg.errInfo == ErrInfo.SuddenStop)
{
Task.Run(()=> {
if (RobotManage.isRunning)
this.Invoke((EventHandler)delegate
{
btn_stop_Click(this, EventArgs.Empty);
});
});
} }
}
this.ResumeLayout(true); this.ResumeLayout(true);
} }
bool userpause = false; bool userpause = false;
...@@ -380,6 +395,7 @@ namespace TheMachine ...@@ -380,6 +395,7 @@ namespace TheMachine
private void btn_run_Click(object sender, EventArgs e) private void btn_run_Click(object sender, EventArgs e)
{ {
LogUtil.info("btn_run_Click:"+sender+e.ToString());
if (!RobotManage.isRunning) if (!RobotManage.isRunning)
{ {
if (RobotManage.mainMachine.IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW)) if (RobotManage.mainMachine.IOValue(IO_Type.SuddenStop_BTN).Equals(IO_VALUE.LOW))
...@@ -402,11 +418,13 @@ namespace TheMachine ...@@ -402,11 +418,13 @@ namespace TheMachine
{ {
userpause = true; userpause = true;
RobotManage.UserPause(userpause); RobotManage.UserPause(userpause);
LogUtil.info("用户按下暂停1");
} }
else if (userpause) else if (userpause)
{ {
userpause = false; userpause = false;
RobotManage.UserPause(userpause); RobotManage.UserPause(userpause);
LogUtil.info("用户取消暂停2");
} }
} }
private void RobotManage_UserPauseSet(object sender, bool e) private void RobotManage_UserPauseSet(object sender, bool e)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!