private void Baffle_Lift_AutoRun(int pulse) { Cursor = Cursors.Wait; //PLC_Tcp.ChangeOut(1); PLC_Com_CP.Baffle_Change(1); int pulse_Now = PLC_Com_CP.ReadBafflePulse_Lift(); if (pulse > pulse_Now) { PLC_Com_CP.BaffleAutoMoveByPulse_Up_Lift(pulse); DateTime timeBegin = DateTime.Now; Thread.Sleep(500); while (!PLC_Com_CP.BaffleAutoMoveIsOK_Up()) { if (DateTime.Now > timeBegin.AddSeconds(Config.Mac_C.WaitTime_Auto_Baffle)) { break; } Thread.Sleep(500); } if (DateTime.Now <= timeBegin.AddSeconds(Config.Mac_C.WaitTime_Auto_Baffle)) { tbPulse_Baffle_Lift_Now.Text = pulse.ToString(); } else { csMsg.ShowWarning("挡板未运行到指定位置", false); } } else { PLC_Com_CP.BaffleAutoMoveByPulse_Down_Lift(pulse); DateTime timeBegin = DateTime.Now; Thread.Sleep(500); while (!PLC_Com_CP.BaffleAutoMoveIsOK_Down()) { if (DateTime.Now > timeBegin.AddSeconds(Config.Mac_C.WaitTime_Auto_Baffle)) { break; } Thread.Sleep(500); } if (DateTime.Now <= timeBegin.AddSeconds(Config.Mac_C.WaitTime_Auto_Baffle)) { tbPulse_Baffle_Lift_Now.Text = pulse.ToString(); } else { csMsg.ShowWarning("挡板未运行到指定位置", false); } } Cursor = null; }
private void btBaffle_Lift_Down_PreviewMouseDown(object sender, MouseButtonEventArgs e) { PLC_Com_CP.Baffle_Change(0); PLC_Com_CP.BaffleMove_Lift(PLC_Com_AP.BaffleMoveType_Lift.Down); }