Ejemplo n.º 1
0
        static bool 撤销Validation(专家任务 zjrw, 撤销专家任务 cx)
        {
            switch (cx)
            {
            case 撤销专家任务.撤销监控:
                if (zjrw.车辆作业.结束时间 != null)
                {
                    MessageForm.ShowWarning("专家任务的车辆作业已结束,无法撤销");
                    return(false);
                }
                break;

            case 撤销专家任务.撤销车辆作业:
                if (zjrw.车辆作业.开始时间 != null)
                {
                    MessageForm.ShowWarning("专家任务的车辆作业已开始监控,无法撤销");
                    return(false);
                }
                break;

            case 撤销专家任务.撤销任务下达:
                if (zjrw.车辆作业 != null)
                {
                    MessageForm.ShowWarning("专家任务已安排车辆作业,无法撤销");
                    return(false);
                }
                break;

            default:
                throw new ArgumentOutOfRangeException("撤销任务 out of range");
            }
            return(true);
        }
Ejemplo n.º 2
0
        void 专家任务管理_DoubleClick(object sender, EventArgs e)
        {
            Xceed.Grid.Cell srcCell = sender as Xceed.Grid.Cell;
            if (srcCell == null)
            {
                return;
            }

            专家任务 zjrw = srcCell.ParentRow.Tag as 专家任务;

            if (zjrw != null)
            {
                if (srcCell.ParentColumn.FieldName == "撤销监控")
                {
                    撤销专家任务的车辆作业监控(zjrw);
                }
                else if (srcCell.ParentColumn.FieldName == "撤销车辆作业")
                {
                    撤销专家任务的车辆作业(zjrw);
                }
                else if (srcCell.ParentColumn.FieldName == "撤销任务下达")
                {
                    撤销专家任务下达(zjrw);
                }
            }

            btn刷新_Click(btn刷新, EventArgs.Empty);
        }
Ejemplo n.º 3
0
        private void btn确定_Click(object sender, EventArgs e)
        {
            if (m_cm.SaveCurrent())
            {
                m_zjrw.时间要求始 = (DateTime)m_cm.DisplayManager.DataControls["时间要求始"].SelectedDataValue;
                m_zjrw.时间要求止 = (DateTime)m_cm.DisplayManager.DataControls["时间要求止"].SelectedDataValue;
                m_zjrw.区域编号  = (string)m_cm.DisplayManager.DataControls["区域编号"].SelectedDataValue;
                m_zjrw.缓急程度  = (int)m_cm.DisplayManager.DataControls["缓急程度"].SelectedDataValue;

                // 静态紧急下达
                if (m_rw == null)
                {
                    m_专家任务Dao.达专家任务(m_zjrw, System.DateTime.Now);
                }
                // 动态调度
                else
                {
                    m_zjrw = m_专家任务Dao.生成专家任务(m_zjrw, m_rw, m_xz);
                }
            }
            else
            {
                this.DialogResult = System.Windows.Forms.DialogResult.None;
            }
        }
 private bool 是否能组合(专家任务 x, 车辆 y, int 后续作业计划)
 {
     if (后续作业计划 < 1)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 5
0
        public 紧急下达(专家任务 zjrw)
        {
            m_zjrw = zjrw;
            InitializeComponent();

            m_cm = AssociateDataControlsInControlManager(new Control[] {
                pnl区域编号, pnl时间要求始, pnl时间要求止, pnl缓急程度
            },
                                                         m_gridName);
        }
Ejemplo n.º 6
0
        private static void 撤销专家任务的车辆作业(专家任务 entity)
        {
            if (entity.车辆作业 == null)
            {
                return;
            }

            if (撤销Validation(entity, 撤销专家任务.撤销车辆作业))
            {
                m_车辆作业dao.撤销车辆作业(entity.车辆作业);
            }
        }
Ejemplo n.º 7
0
        private static void 撤销专家任务的车辆作业监控(专家任务 entity)
        {
            if (entity.车辆作业 == null || entity.车辆作业.开始时间 == null)
            {
                return;
            }

            if (撤销Validation(entity, 撤销专家任务.撤销监控))
            {
                m_车辆作业dao.撤销监控(entity.车辆作业);
            }
        }
Ejemplo n.º 8
0
        private static void 撤销专家任务下达(专家任务 entity)
        {
            if (!entity.达时间.HasValue)
            {
                return;
            }

            if (撤销Validation(entity, 撤销专家任务.撤销任务下达))
            {
                entity.达时间 = null;
                m_专家任务dao.Update(entity);
            }
        }
        void 已优化任务_DoubleClick(object sender, EventArgs e)
        {
            Xceed.Grid.Cell srcCell = sender as Xceed.Grid.Cell;
            if (srcCell == null)
            {
                return;
            }
            srcCell.ParentRow.EndEdit();

            if (srcCell.ParentColumn.FieldName == "移出")
            {
                if (srcCell.ParentRow.ForeColor == m_disableColor)
                {
                    srcCell.ParentGrid.DataRows.Remove(srcCell.ParentRow as Xceed.Grid.DataRow);
                }
            }
            else if (srcCell.ParentColumn.FieldName == "确认")
            {
                if (srcCell.ParentRow.ForeColor == m_disableColor)
                {
                    return;
                }

                if (专家任务下达Validation(srcCell.ParentRow))
                {
                    专家任务 entity = srcCell.ParentRow.Tag as 专家任务;
                    //entity.时间要求始 = (DateTime)srcCell.ParentRow.Cells["时间要求始"].Value;
                    //entity.时间要求止 = (DateTime)srcCell.ParentRow.Cells["时间要求止"].Value;
                    entity.时间要求始 = entity.时间要求始;
                    entity.时间要求止 = entity.时间要求止;
                    entity.区域编号  = (string)srcCell.ParentRow.Cells["区域名称"].Value;
                    entity.缓急程度  = (int)srcCell.ParentRow.Cells["缓急程度"].Value;
                    if (m_dao.达专家任务(entity, System.DateTime.Now))
                    {
                        srcCell.ParentRow.ForeColor = m_disableColor;
                        srcCell.ParentRow.ReadOnly  = true;
                    }
                }
            }
        }
        private void  择组合(DataUnboundGrid gridX, DataUnboundGrid gridY)
        {
            专家调度一级静态优化.Clear组合(gridX, gridY);

            if (gridX.CurrentRow == null)
            {
                return;
            }

            if (gridX == m_待排任务Grid)
            {
                专家任务 x = gridX.CurrentRow.Tag as 专家任务;;
                foreach (Xceed.Grid.DataRow row in gridY.DataRows)
                {
                    string s = (string)row.Cells["后续作业计划"].Value;   // 1/2
                    int    v1 = 0, v2 = 0;
                    int    idx = s.IndexOf('/');
                    if (idx != -1)
                    {
                        int?v = ConvertHelper.ToInt(s.Substring(0, idx));
                        if (v.HasValue)
                        {
                            v1 = v.Value;
                        }
                        v = ConvertHelper.ToInt(s.Substring(idx + 1));
                        if (v.HasValue)
                        {
                            v2 = v.Value;
                        }
                    }
                    if (是否能组合(x, row.Tag as 车辆, v1 + v2))
                    {
                        row.Font = new Font(row.Font, FontStyle.Bold);
                    }
                }
            }
            else if (gridX == m_待命车辆_单车单任务Grid)
            {
                string s = (string)gridX.CurrentDataRow.Cells["后续作业计划"].Value;   // 1/2
                int    v1 = 0, v2 = 0;
                int    idx = s.IndexOf('/');
                if (idx != -1)
                {
                    int?v = ConvertHelper.ToInt(s.Substring(0, idx));
                    if (v.HasValue)
                    {
                        v1 = v.Value;
                    }
                    v = ConvertHelper.ToInt(s.Substring(idx + 1));
                    if (v.HasValue)
                    {
                        v2 = v.Value;
                    }
                }
                foreach (Xceed.Grid.DataRow row in gridY.DataRows)
                {
                    专家任务 x = row.Tag as 专家任务;
                    if (是否能组合(x, row.Tag as 车辆, v1 + v2))
                    {
                        row.Font = new Font(row.Font, FontStyle.Bold);
                    }
                }
            }
        }
        void 车队调度静态任务下达_DoubleClick(object sender, EventArgs e)
        {
            Xceed.Grid.Cell srcCell = sender as Xceed.Grid.Cell;
            if (srcCell == null)
            {
                return;
            }
            srcCell.ParentRow.EndEdit();

            if (srcCell.GridControl == m_待命车辆_单车单任务Grid)
            {
                if (srcCell.ParentColumn.FieldName == "移出")
                {
                    if (srcCell.ParentRow.Cells["作业号"].Value != null)
                    {
                        Xceed.Grid.Cell srcCell2 = srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag as Xceed.Grid.Cell;
                        //srcCell.ParentGrid.DataRows.Remove(srcCell.ParentRow as Xceed.Grid.DataRow);
                        srcCell2.ParentGrid.DataRows.Remove(srcCell2.ParentRow as Xceed.Grid.DataRow);
                        srcCell.ParentRow.Cells["作业号"].Value    = null;
                        srcCell.ParentRow.Cells["作业号"].Tag      = null;
                        srcCell.ParentRow.Cells["中心新任务号"].Value = null;
                        srcCell.ParentRow.Cells["中心新任务号"].Tag   = null;
                    }
                }
                else if (srcCell.ParentColumn.FieldName == "确认")
                {
                    if (srcCell.ParentRow.Cells["作业号"].Value != null)
                    {
                        return;
                    }

                    Xceed.Grid.Cell destCell = srcCell.ParentRow.Cells["中心新任务号"].Tag as Xceed.Grid.Cell;
                    if (destCell == null)
                    {
                        return;
                    }

                    车辆   cl   = srcCell.ParentRow.Tag as 车辆;
                    专家任务 zjrw = destCell.ParentRow.Tag as 专家任务;
                    车辆作业 clzy = m_clzyDao.生成车辆作业(cl, zjrw, (string)srcCell.ParentRow.Cells["作业备注"].Value);
                    srcCell.ParentRow.Cells["作业号"].Value = clzy.作业号;
                    srcCell.ParentRow.Cells["作业号"].Tag   = clzy;

                    srcCell.ParentRow.Cells["中心新任务号"].ForeColor = 专家调度一级静态优化.优化DisableColor;

                    m_待命车辆_单车单任务Grid.ResetRowData(srcCell.ParentRow as Xceed.Grid.DataRow);
                    srcCell.ParentRow.Cells["作业号"].Value = clzy.作业号;
                }
                else if (srcCell.ParentColumn.FieldName == "撤销")
                {
                    if (srcCell.ParentRow.Cells["作业号"].Value != null)
                    {
                        //m_clzyDao.撤销车辆作业(srcCell.ParentRow.Cells["作业号"].Tag as 车辆作业);
                        //srcCell.ParentRow.Cells["作业号"].Value = null;
                        //srcCell.ParentRow.Cells["作业号"].Tag = null;
                        return;
                    }
                    if (srcCell.ParentRow.Cells["中心新任务号"].Value != null)
                    {
                        if (srcCell.ParentRow.Cells["中心新任务号"].Tag == null)
                        {
                            return;
                        }

                        (srcCell.ParentRow.Cells["中心新任务号"].Tag as Xceed.Grid.Cell).ParentRow.ResetForeColor();
                        srcCell.ParentRow.Cells["中心新任务号"].Value = null;
                        srcCell.ParentRow.Cells["中心新任务号"].Tag   = null;
                    }
                }
            }

            if (srcCell.ParentColumn.FieldName == "后续作业计划")
            {
                车辆 cl = srcCell.ParentRow.Tag as 车辆;
                if (cl != null)
                {
                    new 单车后续作业计划(cl).ShowDialog();
                }
            }
            else if (srcCell.ParentColumn.FieldName == "车牌号")
            {
                new 车辆详细信息(srcCell.ParentRow.Tag as 车辆).ShowDialog();
            }
        }
Ejemplo n.º 12
0
        void 车队调度静态任务下达_DoubleClick(object sender, EventArgs e)
        {
            Xceed.Grid.Cell srcCell = sender as Xceed.Grid.Cell;
            if (srcCell == null)
            {
                return;
            }
            srcCell.ParentRow.EndEdit();

            if (srcCell.GridControl == m_待命车辆_单车多任务Grid)
            {
                if (srcCell.ParentColumn.FieldName == "确认")
                {
                    for (int i = 1; i <= m_multiTaskCnt; ++i)
                    {
                        string si = i.ToString();
                        if (srcCell.ParentRow.Cells["中心新任务号" + si].Value != null)
                        {
                            Xceed.Grid.Cell destCell = srcCell.ParentRow.Cells["中心新任务号" + si].Tag as Xceed.Grid.Cell;
                            if (destCell == null)
                            {
                                continue;
                            }

                            if (srcCell.ParentRow.Cells["作业号" + si].Value != null)
                            {
                                continue;
                            }

                            车辆   cl   = srcCell.ParentRow.Tag as 车辆;
                            专家任务 zjrw = destCell.ParentRow.Tag as 专家任务;
                            车辆作业 clzy = m_clzyDao.生成车辆作业(cl, zjrw, (string)srcCell.ParentRow.Cells["作业备注"].Value);
                            srcCell.ParentRow.Cells["作业号" + si].Value = clzy.作业号;
                            srcCell.ParentRow.Cells["作业号" + si].Tag   = clzy;

                            srcCell.ParentRow.Cells["作业号Any"].Value          = clzy.作业号;
                            srcCell.ParentRow.Cells["作业号Any"].Tag            = clzy;
                            srcCell.ParentRow.Cells["中心新任务号" + si].ForeColor = 专家调度一级静态优化.优化DisableColor;
                        }
                    }
                    m_待命车辆_单车多任务Grid.ResetRowData(srcCell.ParentRow as Xceed.Grid.DataRow);
                }
                else if (srcCell.ParentColumn.FieldName == "撤销")
                {
                    if (srcCell.ParentRow.Cells["作业号Any"].Value != null)
                    {
                        return;
                    }
                    for (int i = 1; i <= m_multiTaskCnt; ++i)
                    {
                        string si = i.ToString();
                        if (srcCell.ParentRow.Cells["中心新任务号" + si].Value != null)
                        {
                            if (srcCell.ParentRow.Cells["中心新任务号" + si].Tag == null)
                            {
                                continue;
                            }

                            (srcCell.ParentRow.Cells["中心新任务号" + si].Tag as Xceed.Grid.Cell).ParentRow.ResetForeColor();
                            srcCell.ParentRow.Cells["中心新任务号" + si].Value = null;
                            srcCell.ParentRow.Cells["中心新任务号" + si].Tag   = null;
                        }
                    }
                }
            }

            if (srcCell.ParentColumn.FieldName == "后续作业计划")
            {
                车辆 cl = srcCell.ParentRow.Tag as 车辆;
                if (cl != null)
                {
                    new 单车后续作业计划(cl).ShowDialog();
                }
            }
            else if (srcCell.ParentColumn.FieldName == "车牌号")
            {
                new 车辆详细信息(srcCell.ParentRow.Tag as 车辆).ShowDialog();
            }
        }
Ejemplo n.º 13
0
        internal static void 专家调度一级静态优化_DoubleClick(Xceed.Grid.Cell srcCell, 专家任务性质?zjrwxz)
        {
            if (srcCell == null)
            {
                return;
            }

            if (srcCell.ParentColumn.FieldName == "移出")
            {
                if (srcCell.ParentRow.Cells["新任务号"].Value != null)
                {
                    Xceed.Grid.Cell srcCell2 = srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag as Xceed.Grid.Cell;
                    srcCell.ParentGrid.DataRows.Remove(srcCell.ParentRow as Xceed.Grid.DataRow);
                    srcCell2.ParentGrid.DataRows.Remove(srcCell2.ParentRow as Xceed.Grid.DataRow);
                }
            }
            else if (srcCell.ParentColumn.FieldName == "取消")
            {
                任务 x = null, y = null;
                if (srcCell.ParentRow.Cells["新任务号"].Value != null)
                {
                    //x = srcCell.ParentRow.Tag as 任务;
                    return;
                }
                if (srcCell.ParentRow.Cells[m_topGridDragFildeName].Value != null)
                {
                    if (srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag != null)
                    {
                        y = (srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag as Xceed.Grid.Cell).ParentRow.Tag as 任务;
                    }
                }
                if (m_dao.撤销专家任务(x, y))
                {
                    if (srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag != null)
                    {
                        (srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag as Xceed.Grid.Cell).ParentRow.ResetForeColor();
                    }
                    srcCell.ParentRow.ResetForeColor();
                    srcCell.ParentRow.Cells[m_topGridDragFildeName].Value = null;
                    srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag   = null;
                    srcCell.ParentRow.Cells["新任务号"].Value = null;
                }
                else
                {
                    Feng.MessageForm.ShowWarning("无法移出任务!", "操作失败");
                }
            }
            else if (srcCell.ParentColumn.FieldName == "确认")
            {
                if (srcCell.ParentRow.Cells["新任务号"].Value != null)
                {
                    return;
                }

                Xceed.Grid.Cell destCell = srcCell.ParentRow.Cells[m_topGridDragFildeName].Tag as Xceed.Grid.Cell;
                if (destCell == null)
                {
                    return;
                }

                任务   x    = srcCell.ParentRow.Tag as 任务;
                任务   y    = destCell.ParentRow.Tag as 任务;
                专家任务 zjrw = null;

                string bz = null;
                if (srcCell.ParentRow.Cells["备注"].Value != null)
                {
                    bz = (string)srcCell.ParentRow.Cells["备注"].Value;
                }

                zjrw = m_dao.生成专家任务(x, y, zjrwxz, bz);

                if (zjrw != null)
                {
                    srcCell.ParentRow.Cells["新任务号"].Value = zjrw.新任务号;
                    srcCell.ParentRow.Cells["新任务号"].Tag   = zjrw;
                }
            }
            else if (srcCell.ParentColumn.FieldName == "紧急下达")
            {
                if (srcCell.ParentRow.Cells["新任务号"].Tag != null)
                {
                    var zjrw = srcCell.ParentRow.Cells["新任务号"].Tag as 专家任务;
                    if (!zjrw.达时间.HasValue)
                    {
                        using (var form = new 紧急下达(zjrw))
                        {
                            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                srcCell.ParentRow.Cells["新任务号"].Tag = form.专家任务;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 14
0
 // 动态调度-下达
 public 紧急下达(专家任务 zjrw, 任务 rw, 专家任务性质?xz)
     : this(zjrw)
 {
     m_rw = rw;
     m_xz = xz;
 }