private void grdRouters_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(typeof(WorkUnit))) { WorkUnit source = (WorkUnit)e.Data.GetData(typeof(WorkUnit)); // 获取鼠标拖放位置 point = grdRouters.PointToClient(new Point(e.X, e.Y)); DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = grdvRouters.CalcHitInfo(point); if (hi.RowHandle >= 0 && hi.RowHandle < routers.Count) { if (hi.Column == grdclmnCurrWorkUnit) { if (routers[hi.RowHandle].NextWorkUnit.T107LeafID == source.T107LeafID) { XtraMessageBox.Show("当前工位和下一工位不能是相同的工位!", "系统信息", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { routers[hi.RowHandle].CurrWorkUnit = source.Clone(); ArrangeReworkRouters(); } } else if (hi.Column == grdclmnPrevWorkUnit) { if (routers[hi.RowHandle].CurrWorkUnit.T107LeafID == source.T107LeafID) { XtraMessageBox.Show("当前工位和下一工位不能是相同的工位!", "系统信息", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { routers[hi.RowHandle].NextWorkUnit = source.Clone(); ArrangeReworkRouters(); } } } else { GUIReworkRouter router = new GUIReworkRouter() { CurrWorkUnit = source.Clone() }; routers.Add(router); grdvRouters.FocusedRowHandle = routers.Count - 1; ArrangeReworkRouters(); } } }