Ejemplo n.º 1
0
 private void updatePanel()
 {
     foreach (SingleTask st in singleTaskList)
     {
         TaskButton button = (TaskButton)buttonStHash[st.taskID];
         if (st.taskStat == TASKSTAT_T.TASK_READY_SEND || st.taskStat == TASKSTAT_T.TASK_END)                 //待可以发送状态,可以取消该任务
         {
             button.BackColor = Color.LightGray;
         }
         else if (st.taskStat == TASKSTAT_T.TASK_SEND || st.taskStat == TASKSTAT_T.TASK_SEND_SUCCESS)
         {
             button.BackColor = Color.Green;
         }
     }
 }
Ejemplo n.º 2
0
        private void initPanel()
        {
            foreach (SingleTask st in singleTaskList)
            {
                TaskButton button = new TaskButton();
                if (st.taskType == TASKTYPE_T.TASK_TYPE_UP_DILIVERY || st.taskType == TASKTYPE_T.TASK_TYPE_UP_PICK)
                {
                    if (st.taskType == TASKTYPE_T.TASK_TYPE_UP_DILIVERY)
                    {
                        button.MouseDown += taskButtonMouseDown;                          //卸货1、2界面不能发送,需要到配置中单独发送
                    }
                    button.Name   = st.taskName;
                    button.Text   = st.taskText;
                    button.Click += button.click;
                    Console.WriteLine(" button name = " + button.Text);
                    upButtonList.Add(button);
                    upPanel.Controls.Add(button);
                }
                else if (st.taskType == TASKTYPE_T.TASK_TYPE_DOWN_DILIVERY || st.taskType == TASKTYPE_T.TASK_TYPE_DOWN_PICK)
                {
                    button.Name = st.taskName;
                    button.Text = st.taskText;
                    downButtonList.Add(button);
                    downPanel.Controls.Add(button);
                }

                button.setSingleTask(st);
                buttonStHash.Add(st.taskID, button);
            }

            addAllTaskRecordButton.Location = new Point(1150, 70);
            addAllTaskRecordButton.Size     = new Size(120, 40);
            addAllTaskRecordButton.Click   += addAllTaskRecordButton_Click;
            upPanel.Controls.Add(addAllTaskRecordButton);

            this.systemPauseButton.Name = "pause";
            this.systemPauseButton.Text = "系统暂停";
            systemPauseButton.Location  = new Point(90, 100);
            systemPauseButton.Size      = new Size(120, 60);
            systemPauseButton.Click    += systemPauseButton_Click;
            systemPauseButton.BackColor = Color.DarkGray;
            systemPauseButton.Font      = new Font("SimSun", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            controlPanel.Controls.Add(systemPauseButton);
            initUserPanel();            //最底下的panel
            initAgvPanel();             //初始化单车信息的Panel
        }
Ejemplo n.º 3
0
        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));
                }
            }
        }
Ejemplo n.º 4
0
        private void _updateFrm()
        {
            while (!isStop)
            {
                _updateAgvPanel();
                _updateSystemPause();                 //如果设置系统暂停后,界面需要更新,用户不能再操作
                if (!isUpdateFrm)
                {
                    Thread.Sleep(1000);
                    continue;
                }
                lock (LockController.getLockController().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;
            }
        }
Ejemplo n.º 5
0
        public void initMainFrm()
        {
            MenuItem addItem = new MenuItem("添加");

            addItem.Name   = "addPalletItem";
            addItem.Name   = "addPalletItem";
            addItem.Click += new EventHandler(palletItemClick);
            addTasktMenu.MenuItems.Add(addItem);

            MenuItem cancelItem = new MenuItem("取消");

            cancelItem.Name   = "cancelTaskItem";
            cancelItem.Click += new EventHandler(cancelItemClick);

            cancelTasktMenu.MenuItems.Add(cancelItem);

            MenuItem toplItem = new MenuItem("置顶");              //将该任务的优先级提到最高

            toplItem.Name   = "topTaskItem";
            toplItem.Click += new EventHandler(topItemClick);
            cancelTasktMenu.MenuItems.Add(toplItem);



            initPanel();
            updatePanel();
            foreach (DictionaryEntry de in buttonStHash)
            {
                int        id     = (int)de.Key;
                TaskButton button = (TaskButton)de.Value;
                switch (id)
                {
                case 1:
                    // 上货
                    button.Location = new System.Drawing.Point(291, 65);
                    button.Size     = new System.Drawing.Size(96, 29);
                    break;

                case 2:
                    //卸货A
                    button.Location = new System.Drawing.Point(498, 65);
                    button.Size     = new System.Drawing.Size(96, 29);
                    break;

                case 3:
                    //卸货B
                    button.Location = new System.Drawing.Point(699, 65);
                    button.Size     = new System.Drawing.Size(96, 29);
                    break;

                case 4:
                    // 1号
                    button.Location = new System.Drawing.Point(109, 50);
                    button.Size     = new System.Drawing.Size(96, 29);
                    break;

                case 5:
                    //2号
                    button.Location = new System.Drawing.Point(109, 100);
                    button.Size     = new System.Drawing.Size(96, 29);
                    break;

                case 6:
                    //3号
                    button.Location = new System.Drawing.Point(239, 50);
                    button.Size     = new System.Drawing.Size(96, 29);
                    break;

                case 7:
                    // 4号
                    button.Location = new System.Drawing.Point(239, 100);
                    button.Size     = new System.Drawing.Size(96, 29);
                    break;

                case 8:
                    //5号
                    button.Location = new System.Drawing.Point(389, 50);
                    button.Size     = new System.Drawing.Size(96, 29);
                    break;

                case 9:
                    //6号
                    button.Location = new System.Drawing.Point(389, 100);
                    button.Size     = new System.Drawing.Size(96, 29);


                    break;

                case 16:
                    //卸货6号
                    button.Location = new System.Drawing.Point(989, 50);
                    button.Size     = new System.Drawing.Size(96, 29);
                    break;

                case 10:
                    //7号
                    button.Location = new System.Drawing.Point(539, 50);
                    button.Size     = new System.Drawing.Size(96, 29);
                    break;

                case 11:
                    //8号
                    button.Location = new System.Drawing.Point(539, 100);
                    button.Size     = new System.Drawing.Size(96, 29);
                    break;

                case 12:
                    //9号
                    button.Location = new System.Drawing.Point(689, 50);
                    button.Size     = new System.Drawing.Size(96, 29);
                    break;

                case 13:
                    // 10号
                    button.Location = new System.Drawing.Point(689, 100);
                    button.Size     = new System.Drawing.Size(96, 29);
                    break;

                case 14:
                    //11号
                    button.Location = new System.Drawing.Point(839, 50);
                    button.Size     = new System.Drawing.Size(96, 29);
                    break;

                case 17:
                    //卸货12
                    button.Location = new System.Drawing.Point(989, 100);
                    button.Size     = new System.Drawing.Size(96, 29);
                    break;

                case 15:
                    //12号
                    button.Location = new System.Drawing.Point(839, 100);
                    button.Size     = new System.Drawing.Size(96, 29);
                    break;
                }
            }
            startUpdateThread();
            //this.Update();
        }