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 _updateFrm() { while (!isStop) { _updateAgvPanel(); _updateSystemPause(); //如果设置系统暂停后,界面需要更新,用户不能再操作 if (!isUpdateFrm) { Thread.Sleep(1000); continue; } lock (AGVInitialize.getInitialize().getLockTask()) { foreach (DictionaryEntry de in buttonStHash) { int taskID = (int)de.Key; TaskButton tb = (TaskButton)de.Value; //Console.WriteLine(" look task id = " + taskID); TaskRecord tr = lookTaskRecordByTaskId(taskID); tb.bindValue(tr); if (tr != null) { if (tr.taskRecordStat == TASKSTAT_T.TASK_READY_SEND) { tb.BackColor = Color.LightGray; } else if (tr.taskRecordStat == TASKSTAT_T.TASK_SEND || tr.taskRecordStat == TASKSTAT_T.TASK_SEND_SUCCESS) { tb.BackColor = Color.LightGreen; } } else { tb.BackColor = Color.White; //没有任务记录表示,任务执行完成或没有发送任务,颜色改为白色 } } } isUpdateFrm = false; } }