private void checkBox1_Click(object sender, EventArgs e) { if (checkBox1.Checked) { Clear(); sgSet = new SGSet(SL, pr); if (checkBox2.Checked) { jDemagnetizer.Start(0); } if (checkBox3.Checked) { string ret = sgSet.StartGSPF(); if (ret != null) { prstat(ret); Reset(); checkBox1.Checked = false; checkBox1.Text = checkBox1.Checked ? "Выключить" : "Включить"; return; } } label2.Text = sgSet.CheckDTypeSize()?null:"Датчики не соответствуют типоразмеру"; SolidGroupPars sgpars = ParAll.SG; L502Ch[] MCh = new L502Ch[6] { sgpars.Sensor_I, sgpars.Sensor_B, sgpars.Sensor_U, sgpars.Sensor_D0, sgpars.Sensor_D1, sgpars.Sensor_D2 }; sgSet.StartL502(MCh); checkBox2.Enabled = false; checkBox3.Enabled = false; timer1.Enabled = true; } else { pr("3 " + (checkBox1.Checked ? "true" : "false")); timer1.Enabled = false; Reset(); } checkBox1.Text = checkBox1.Checked ? "Выключить" : "Включить"; }
public void Exec(int _tick) { if (!started) { return; } if (IsComplete) { return; } if (IsError) { return; } foreach (IJob job in J) { job.Exec(_tick); if (job.IsError) { LastError = job.LastError; Finish(); return; } } switch (Step) { case 0: if (!sgSet.CheckDTypeSize()) { LastError = "Датчики не соответствуют типоразмеру"; break; } Step = 1; break; case 1: jAlarm.Add(SL.iCC, true); jAlarm.Add(SL.iSGIN, true); jAlarm.Add(SL.iSGOUT, true); Step = 2; break; case 2: SolidGroupPars sgpars = ParAll.SG; L502Ch[] MCh = new L502Ch[2] { sgpars.Sensor_I, sgpars.Sensor_B, }; jDemagnetizer.Start(_tick); string ret = sgSet.Start(tsDefSG, MCh); if (ret != null) { LastError = ret; break; } bank.Start(EUnit.SG, _tick); Step = 3; break; case 3: bank.AddGroup(EUnit.Cross, sgSet.ReadL502()); break; } if (IsError) { Finish(); } }
public void Exec(int _tick) { if (!started) { return; } if (IsComplete) { return; } if (IsError) { return; } foreach (IJob job in J) { job.Exec(_tick); if (job.IsError) { LastError = job.LastError; Finish(); return; } } switch (Step) { case 0: pr("Ждем трубу в ГП"); if (!restart) { jDemagnetizer.CheckSet(); } Step = 1; break; case 1: if (!SL.iSGIN.Val) { break; } bank.Start(EUnit.SG, _tick); jDemagnetizer.Start(_tick); sgSet.StartGSPF(); pr("Ждем трубу в ГП2"); Step = 2; break; case 2: if (!SL.iSGOUT.Val) { break; } pr("Ждем выхода трубы из ГП"); Step = 3; break; case 3: if (SL.iSGOUT.Val) { break; } pr("Ждем 1 с после выхода трубы из ГП"); startTick = _tick; Step = 4; break; case 4: if (_tick - startTick < 1000) { break; } Finish(); pr("Закончили"); Step = 4; IsComplete = true; break; case 5: break; } if (IsError) { Finish(); } }