private void palletItemClick(object sender, EventArgs e) { MenuItem item = (MenuItem)sender; Console.WriteLine("select button name = " + selectedButton.Name); TaskRecord tr = (TaskRecord)selectedButton.getBindValue(); if (tr == null) { int number = 0; try { if (selectedButton.st.taskText.Length == 2) { number = int.Parse(selectedButton.st.taskText.Substring(0, 1)); } else if (selectedButton.st.taskText.Length == 3) { number = int.Parse(selectedButton.st.taskText.Substring(0, 2)); } }catch (Exception ex) { Console.WriteLine("parse task nunber err"); } if (number % 2 == 1) //当前添加的是奇数任务,1,3,5,7,9,11号任务 { bool exist = checkDoubleTaskRecord(selectedButton.st.taskID + 1); if (exist) { DialogResult dr; dr = MessageBox.Show(number + 1 + "号任务已经缓存,该任务不能被添加", "任务添加提示", MessageBoxButtons.OK); //有偶数号任务被添加时,前面的奇数号任务不能被添加,否则AGV会撞到前面的货 if (dr == DialogResult.OK) { Console.WriteLine(" palletItemClick invalid "); return; } } } selectedButton.BackColor = Color.LightGray; tr = new TaskRecord(); tr.singleTask = selectedButton.st; tr.taskRecordName = selectedButton.st.taskName; tr.taskRecordStat = TASKSTAT_T.TASK_READY_SEND; AGVInitialize.getInitialize().getSchedule().addTaskRecord(tr); selectedButton.bindValue(tr); } }
private void palletItemClick(object sender, EventArgs e) { MenuItem item = (MenuItem)sender; Console.WriteLine("select button name = " + selectedButton.Name); TaskRecord tr = (TaskRecord)selectedButton.getBindValue(); if (tr == null) { selectedButton.BackColor = Color.LightGray; tr = new TaskRecord(); tr.singleTask = selectedButton.st; tr.taskRecordName = selectedButton.st.taskName; tr.taskRecordStat = TASKSTAT_T.TASK_READY_SEND; AGVInitialize.getInitialize().getSchedule().addTaskRecord(tr); selectedButton.bindValue(tr); } }
private void taskButtonMouseDown(object sender, MouseEventArgs e) { TaskButton button = (TaskButton)sender; if (e.Button == MouseButtons.Right) { selectedButton = button; Console.WriteLine(" select button name = " + selectedButton.Name); //string sql = "select * from taskrecord, singletask where taskRecordStat in (1, 2, 3) and singleTask = singletask.id and singletask.taskName = '" + button.Name + "'"; TaskRecord tr = (TaskRecord)button.getBindValue(); if (tr == null) { addTasktMenu.Show(button, new Point(e.X, e.Y)); } else if (tr.taskRecordStat == TASKSTAT_T.TASK_READY_SEND) //该状态可以取消任务 { cancelTasktMenu.Show(button, new Point(e.X, e.Y)); } } }