管家婆是一款通用的进销存软件,本文以一个范例介绍如何对管家婆进行二次开发,以满足用户的个性化需求。
需求分析
为防止客户货重复申报造成销售订单重复的情况,对一个客户出现多个未完成销售订单时,自动弹出提示。
准备工作
管家婆没有提供开发接口,对其的二次开发主要通过对其数据库的监控来实现,因此首先要了解其数据字典,可参照《管家婆数据字典》。
本次开发用到的表有:订单索引表(DlyndxOrder)、往来单位明细表(btype)
数据库二次开发
在订单索引表中没有订单的建立时间,我们需要新增一列,并建立索引以加快查询速度。
- alter table DlyndxOrder add CreateDate datetime not null default getdate()
- go
- CREATE NONCLUSTERED INDEX [CreateDate] ON [dbo].[DlyNdxOrder]
- (
- [CreateDate] ASC
- )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
- go
程序实现
1、让客户选择是否在本客户端监控以及监控周期。(监控周期指的是多长时间扫描一次数据库同时也是判断销售订单的建立时间是否在提示范围内,避免重复提示的情况。)
代码略
2、通过Timer组件进行循环监控。
- Private Sub TimerDDJK_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimerDDJK.Tick
- Using sqlconn As SqlConnection = New SqlConnection(ConnStr)
- Dim cmd As SqlCommand = New SqlCommand
- cmd.Connection = sqlconn
- cmd.Parameters.AddWithValue("@监控周期", ddjk)
- cmd.CommandText = "select distinct c.fullname" _
- & " from DlyndxOrder a inner join" _
- & " DlyndxOrder b on a.btypeid=b.btypeid and a.vchcode<>b.vchcode inner join" _
- & " btype c on a.btypeid=c.typeid" _
- & " where a.orderover = 0 And a.userover = 0 And b.orderover = 0 And b.userover = 0 and a.vchType=8" _
- & " and getdate()<dateadd(s,@监控周期,a.CreateDate)" _
- & " order by c.fullname"
- Dim dap As SqlDataAdapter = New SqlDataAdapter
- Dim dtb As DataTable = New DataTable
- dap.SelectCommand = cmd
- Try
- dap.Fill(dtb)
- If dtb.Rows.Count > 0 Then
- Dim i As Integer
- Dim s As New System.Text.StringBuilder
- For i = 0 To dtb.Rows.Count - 1
- s.Append(dtb.Rows(i).Item("fullname") & " ")
- Next
- MsgBox("以下客户出现多个未完成订单:" & Microsoft.VisualBasic.vbCrLf & s.ToString, MsgBoxStyle.Information, "提示")
- End If
- Catch ex As Exception
- MsgBox(ex.Message)
- End Try
- End Using
- End Sub
本文介绍了管家婆二次开发的思路,管中窥豹,其他企业管理软件二次开发也可参照。
- 工资小程序
- 员工工资查询小程序
- 我的微信公众号
- 我的微信公众号扫一扫
评论