|
推荐
楼主 |
发表于 2016-12-22 11:38:51
|
只看该作者
源码录入界面 CommomOrder 没有参照 现存量 功能,自己写了一个:
1、在CommonOrder 顶端 添加 Button:btnGetSto ,设置快捷键 F4.
2、给Dg1 添加 KeyDown 事件,
3、给 CommomOrder 添加事件,源码如下:
'========参照现存量
Private Sub btnGetSto_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetSto.Click
If TS.State = Control.MyToolStrip.ToolStripState.None Then
myMsg("请新增或修改单据")
Exit Sub
End If
If CheckData() = False Then
Exit Sub
End If
'==========传递参数=
PasPar()
Dim mdls As Model.Order.CommonOrder.OrdersInfoCollection
If Me.pnl.Controls.Contains(Me.txtCusName) Then
mdls = GetSto.GetSto.GetSto_WithCusCode(Me.VouchType, Me.txtCusName.Value, Me.cWh, Me.cInv, Me.cBatch,
Me.cFr1, Me.cFr2, Me.cFr3, Me.cFr4, Me.cFr5, Me.cFr6, Me.cFr7, Me.cFr8)
ElseIf Me.pnl.Controls.Contains(Me.txtVenName) Then
mdls = GetSto.GetSto.GetSto_WithVenCode(Me.VouchType, Me.txtCusName.Value, Me.cWh, Me.cInv, Me.cBatch,
Me.cFr1, Me.cFr2, Me.cFr3, Me.cFr4, Me.cFr5, Me.cFr6, Me.cFr7, Me.cFr8)
Else
mdls = GetSto.GetSto.GetSto(Me.VouchType)
End If
If mdls.Count <> 0 Then
Dim mdlsTemp As Model.Order.CommonOrder.OrdersInfoCollection = dg1.DataSource
mdlsTemp = Helper.DeleteEmptyRow(mdlsTemp)
mdlsTemp.Merge(mdls)
Helper.AddOrComputeTotalRow(mdlsTemp)
dg1.DataSource = mdlsTemp
End If
End Sub
'' 注意,dg1 进入按F4有效,进入单元格级别(编辑某个单元格时) 按F4,无效,单元格没有定义 F4 的事件。
Private Sub dg1_KeyDown(sender As Object, e As KeyEventArgs) Handles dg1.KeyDown
If e.KeyCode = Keys.F4 Then
If TS.State = Control.MyToolStrip.ToolStripState.None Then
myMsg("请新增或修改单据")
Exit Sub
End If
If CheckData() = False Then
Exit Sub
End If
'==========传递参数=
PasPar()
'===========接受getSto的返回mdl
Dim mdls As Model.Order.CommonOrder.OrdersInfoCollection
If Me.pnl.Controls.Contains(Me.txtCusName) Then
mdls = GetSto.GetSto.GetSto_WithCusCode(Me.VouchType, Me.txtCusName.Value, Me.cWh, Me.cInv, Me.cBatch,
Me.cFr1, Me.cFr2, Me.cFr3, Me.cFr4, Me.cFr5, Me.cFr6, Me.cFr7, Me.cFr8)
ElseIf Me.pnl.Controls.Contains(Me.txtVenName) Then
mdls = GetSto.GetSto.GetSto_WithVenCode(Me.VouchType, Me.txtCusName.Value, Me.cWh, Me.cInv, Me.cBatch,
Me.cFr1, Me.cFr2, Me.cFr3, Me.cFr4, Me.cFr5, Me.cFr6, Me.cFr7, Me.cFr8)
Else
mdls = GetSto.GetSto.GetSto(Me.VouchType)
End If
If mdls.Count <> 0 Then
Dim mdlsTemp As Model.Order.CommonOrder.OrdersInfoCollection = dg1.DataSource
mdlsTemp = Helper.DeleteEmptyRow(mdlsTemp)
mdlsTemp.Merge(mdls)
Helper.AddOrComputeTotalRow(mdlsTemp)
dg1.DataSource = mdlsTemp
End If
End If
End Sub
Private Sub PasPar()
Dim dr As DataGridViewRow = dg1.CurrentRow
Try
cWh = dr.Cells(colWhName.HeaderText).Value.ToString
Catch
cWh = ""
End Try
Try
cInv = dr.Cells(colInvName.HeaderText).Value.ToString
Catch
cInv = ""
End Try
Try
cBatch = dr.Cells(colBatch.HeaderText).Value.ToString
Catch
cBatch = ""
End Try
Try
cFr1 = dr.Cells(colInvFree1.HeaderText).Value.ToString
Catch
cFr1 = ""
End Try
Try
cFr2 = dr.Cells(colInvFree2.HeaderText).Value.ToString
Catch
cFr2 = ""
End Try
Try
cFr3 = dr.Cells(colInvFree3.HeaderText).Value.ToString
Catch
cFr3 = ""
End Try
Try
cFr4 = dr.Cells(colInvFree4.HeaderText).Value.ToString
Catch
cFr4 = ""
End Try
Try
cFr5 = dr.Cells(colInvFree5.HeaderText).Value.ToString
Catch
cFr5 = ""
End Try
Try
cFr6 = dr.Cells(colInvFree6.HeaderText).Value.ToString
Catch
cFr6 = ""
End Try
Try
cFr7 = dr.Cells(colInvFree7.HeaderText).Value.ToString
Catch
cFr7 = ""
End Try
Try
cFr8 = dr.Cells(colInvFree8.HeaderText).Value.ToString
Catch
cFr8 = ""
End Try
End Sub
4、库存参照的源码在附件中,请自行添加到程序OrderView中;
注、源程序只有两个自由项,这段代码中有 8个 自由项,那是我二开时加的,请把多余的6个去掉。
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|