Dim zbr As Row = Tables(e.Form.TableName).Current '主表数据行 Dim rp As Date If zbr.IsNull("日期") Then '写入保存日期时间 zbr("日期") = Functions.Execute("GetDate",rp) zbr("DeptID") = _DeptID zbr("OperID") = _OperID End If zbr("修改时间") = Functions.Execute("GetDate",rp) zbr("修改人") = _UserName '**********生成单号并检测唯一************ If zbr.IsNull("单号") Then Functions.Execute("FTzdbmhs",e.Form.TableName,"入库单编号") Dim dr As DataRow = DataTables("产品出入库信息").SQLFind("单号 = '" & zbr("单号") & "'") Do While dr IsNot Nothing '单号重复时删除单号临时登记并再次生成单号 DataTables("Ft临时编码表").SQLDeleteFor("编码值 = '" & zbr("单号") & "'") Functions.Execute("FTzdbmhs",e.Form.TableName,"入库单编号") dr = DataTables("产品出入库信息").SQLFind("单号 = '" & zbr("单号") & "'") Loop End If '**************明细表中加入单号及出入库类型,类型不同时并更新类型************* For Each r As DataRow In DataTables("FT出入库").DataRows If r.IsNull("产品料号") = False Then If r.IsNull("单号") Then r("单号") = zbr("单号") r("出入库类型") = "入库" r("日期") = zbr("日期") End If If r("类型") <> zbr("单据类型") AndAlso r("单号") = zbr("单号") Then r("类型") = zbr("单据类型") End If End If Next '**********检查必填项************** Dim bn As WinForm.SplitPanel = e.Form.Controls("分区").Panel2 For Each mz As WinForm.Control In bn.Children If Typeof mz Is WinForm.TextBox Or Typeof mz Is WinForm.DateTimePicker Or Typeof mz Is WinForm.ComboBox Then '判断控件是否是文本框 If e.Form.Controls(mz.Name).Value Is Nothing And mz.Name <> "说明" Then MessageBox.show("'" & mz.Name & "'项为空,不可保存!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Return End If End If Next DataTables("FT出入库").DeleteFor("单号 = '' Or 单号 Is null") Dim drk As DataRow = DataTables("FT出入库").Find("仓库名称 = '' or 仓库名称 is null") If drk IsNot Nothing Then MessageBox.show("仓库名称不可为空,禁止保存!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Return End If drk = DataTables("FT出入库").Find("数量 is null") If drk IsNot Nothing Then MessageBox.show("数量不可为空,禁止保存!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Return End If '************保存数据********** zbr.Save() DataTables("FT出入库").Save() DataTables("FT出入库").Load DataTables("Ft临时编码表").SQLDeleteFor("编码值 = '" & zbr("单号") & "'") '删除临时单号登记 '**********结束独占编辑*************** 'If zbr.DataRow.RowState = DataRowState.Modified Then Dim Key As String = e.Form.TableName & ":" & zbr.DataRow("_Identify") If tbrk.Contains(Key) Then tbrk.Remove(Key) '移除本地编辑登记 QQClient.Send("!#" & Key & "#!") '通知服务器此行已经结束编辑 End If 'End If '**********锁定主表项************** For Each mz As WinForm.Control In bn.Children If Typeof mz Is WinForm.TextBox Or Typeof mz Is WinForm.DateTimePicker Or Typeof mz Is WinForm.ComboBox Then '判断控件是否是文本框 e.Form.Controls(mz.Name).ReadOnly = BooleanEnum.True End If Next '****************锁定数据表************************* Tables("FT出入库").AllowEdit = False '**************刷新查询,显示出最新数据************** e.Form.Controls("保存").Visible = False e.Form.Controls("放弃").Visible = False e.Form.Controls("状态").text = "查看" Dim cxbn As WinForm.Button = e.Form.Controls("清除刷新") cxbn.PerformClick() '****************更新菜单************ MainTable = Tables("MainTable") MainTable = Tables(e.Form.TableName)
|