自己备忘。
Dim tbl As DataTable = GetFullPackLotList(order.ShipOrderID)
For Each row As DataRow In tbl.Rows
Debug.Print(row.Item(TBC.strLotNo))
Next
Dim _mcc As Collection = (New NF.ShipOrderPackBox).Fill(Me.GetShipOrderPackBoxList(order.ShipOrderID))
If _mcc.Count > 0 Then
For i As Integer = 1 To _mcc.Count
Debug.Print(CType(_mcc.Item(i), NF.ShipOrderPackBox).LotNo)
Next
End If
Private Function BoxTB(ByVal tb As DataTable) As DataTable
Dim tbNew As New DataTable
tbNew = tb.Copy
tbNew.Columns.Add("类别", GetType(String), "iif(" & TBC.lngHaltType & "=1,'全部','部份')")
tbNew.Columns.Add("模式", GetType(String), "iif(" & TBC.lngHaltProductionMode & "=1,'推','延')")
tbNew.Columns("类别").SetOrdinal(2)
tbNew.Columns("模式").SetOrdinal(7)
Return tbNew
End Function
Private Sub Dv_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Dv.MouseMove
If (e.Button And Windows.Forms.MouseButtons.Left) <> Windows.Forms.MouseButtons.Left Then Return
Dim ht As DataGridView.HitTestInfo
Dim obj As DataGridView = CType(sender, DataGridView)
ht = obj.HitTest(e.X, e.Y)
If ht.Type <> DataGridViewHitTestType.Cell Then Return
If Control.ModifierKeys = Keys.Control Then
dragData = New DragDataObject(eDragType.MoveXRowToOtherXRow, obj.SelectedRows)
obj.DoDragDrop(dragData, DragDropEffects.All)
'OnRowDragOver(-1)
Else
dragData = New DragDataObject(eDragType.MoveOrderToXRow, obj.SelectedRows)
obj.DoDragDrop(dragData, DragDropEffects.All)
'OnRowDragOver(-1)
End If
End Sub
Private Sub Dv_RowPostPaint(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowPostPaintEventArgs) Handles Dv.RowPostPaint
If e.RowIndex = indexOfItemUnderMouseOver Then
e.Graphics.DrawRectangle(Pens.Red, e.RowBounds.X, e.RowBounds.Y, e.RowBounds.Width - 1, e.RowBounds.Height - 1)
End If
End Sub
Private Sub OnRowDragOver(ByVal rowIndex As Integer)
If (indexOfItemUnderMouseOver = rowIndex) Then Return
Dim old As Integer = indexOfItemUnderMouseOver
indexOfItemUnderMouseOver = rowIndex
If (old > -1) Then Me.DgvPlanAll.InvalidateRow(old)
If (rowIndex > -1) Then Me.DgvPlanAll.InvalidateRow(rowIndex)
End Sub
#Region "--XRow拖放操作--" Private Sub XpTableLots_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles XpTableLots.MouseMove If e.Button = Windows.Forms.MouseButtons.Left Then With Me.XpTableLots If .SelectedIndicies.Length > 0 Then Dim drg As DragDataObject = New DragDataObject(eDragType.MoveBoxXRowToDv, .TableModel.Rows(.SelectedIndicies(0))) .DoDragDrop(drg, DragDropEffects.All) End If End With End If End Sub Private Sub XpTableLots_DragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles XpTableLots.DragOver If e.Data.GetDataPresent(GetType(DragDataObject)) Then Dim drg As DragDataObject drg = e.Data.GetData(GetType(DragDataObject)) If drg.DragType = eDragType.MoveBoxDvToXRowFull OrElse drg.DragType = eDragType.MoveBoxDvToXRowMerge Then e.Effect = DragDropEffects.Move Else e.Effect = DragDropEffects.None End If Else e.Effect = DragDropEffects.None End If End Sub Private Sub XpTableLots_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles XpTableLots.DragDrop If e.Data.GetDataPresent(GetType(DragDataObject)) Then Dim drg As DragDataObject drg = e.Data.GetData(GetType(DragDataObject)) If drg.DragType = eDragType.MoveBoxDvToXRowFull OrElse drg.DragType = eDragType.MoveBoxDvToXRowMerge Then xRow = CType(drg.Data, XPTable.Models.Row) ChangeLotSumQty(xRow.Cells(eBoxCol.LotNo).Text, xRow.Cells(eBoxCol.SumQty).Data) xRow.TableModel.Table.TableModel.Rows.Remove(xRow) CalcutlateXPSumQty() End If End If End Sub #End Region