VB实例编程:eXpressAppFramework生成单据编号的解决方案
来源:优易学  2011-8-28 15:38:51   【优易学:中国教育考试门户网】   资料下载   IT书店

 

 Set(ByVal value As String)
  SetPropertyValue("TBCAPTION", FTBCAPTION, value)
  End Set
  End Property
  Private FPREX As String
  <DevExpress.Xpo.DisplayName("单据编号前缀")> _
  Public Property PREX() As String
  Get
  Return FPREX
  End Get
  Set(ByVal value As String)
  SetPropertyValue("PREX", FPREX, value)
  End Set
  End Property
  Private FLENTH As Integer = 5
  <DevExpress.Xpo.DisplayName("流水号位数")> _
  Public Property LENTH() As Integer
  Get
  Return FLENTH
  End Get
  Set(ByVal value As Integer)
  SetPropertyValue("LENTH", FLENTH, value)
  End Set
  End Property
  Private FINTERVAL As String = "-"
  <DevExpress.Xpo.DisplayName("分隔符")> _
  Public Property INTERVAL() As String
  Get
  Return FINTERVAL
  End Get
  Set(ByVal value As String)
  SetPropertyValue("INTERVAL", FINTERVAL, value)
  End Set
  End Property
  Public Enum EPREX
  无
  年
  年月
  年月日
  End Enum
  Private FDPREX As EPREX
  <DevExpress.Xpo.DisplayName("日期段")> _
  Public Property DPREX() As EPREX
  Get
  Return FDPREX
  End Get
  Set(ByVal value As EPREX)
  SetPropertyValue("DPREX", FDPREX, value)
  End Set
  End Property
  End Class
  2.单据编号生成函数
  生成单据编号函数
  1    Public Function UPDATEBILLCODE()Function UPDATEBILLCODE(ByVal FBCODE As String, ByVal BO As Object)
  2    Dim BILLCODEPREX As B_BILLCODEPREX = Session.FindObject(Of B_BILLCODEPREX)(New BinaryOperator("TBNAME", BO.GetType.Name))
  3    If BILLCODEPREX IsNot Nothing Then
  4    If BILLCODEPREX.TBNAME IsNot Nothing Then
  5    If BO.GetType.Name = BILLCODEPREX.TBNAME.Trim Then
  6    Dim BB As String = ""
  7    Dim PRE As String = ""
  8    If BILLCODEPREX.INTERVAL Is Nothing Then
  9    BB = ""
  10    Else
  11    BB = BILLCODEPREX.INTERVAL.Trim
  12    End If
  13    If Not BILLCODEPREX.PREX.Trim = Nothing Then
  14    PRE = BILLCODEPREX.PREX.ToUpper.Trim & BB
  15    Else
  16    PRE = ""
  17    End If
  18    Dim CC As String = ""
  19    If Not BILLCODEPREX.DPREX = Nothing Then
  20    Select Case BILLCODEPREX.DPREX
  21    Case B_BILLCODEPREX.EPREX.年
  22    CC = Format(Now.Year, "00").ToString & BB
  23    Case B_BILLCODEPREX.EPREX.年月
  24    CC = Format(Now.Year, "00").ToString & BB & Format(Now.Month, "00").ToString & BB
  25    Case B_BILLCODEPREX.EPREX.年月日
  26    CC = Format(Now.Year, "00").ToString & BB & Format(Now.Month, "00").ToString & BB & Format(Now.Day, "00").ToString & BB
  27    Case B_BILLCODEPREX.EPREX.无
  28    CC = ""
  29    End Select
  30    Else
  31    CC = ""
  32    End If
  33    Dim fLOWlenth As Integer = 4
  34    Dim AA As String = ""
  35    If BILLCODEPREX.LENTH > 0 Then
  36    fLOWlenth = BILLCODEPREX.LENTH
  37    End If
  38    For I = 1 To fLOWlenth Step 1
  39    AA &= "0"
  40    Next
  41    FBCODE = PRE & CC & Format(DistributedIdGeneratorHelper.Generate(BO.Session.DataLayer, BO.[GetType]().FullName, CC), AA)
  42    Else
  43    FBCODE = Format(DistributedIdGeneratorHelper.Generate(BO.Session.DataLayer, BO.[GetType]().FullName, "ERP"), "00000000")
  44    End If
  45    Else
  46    FBCODE = Format(DistributedIdGeneratorHelper.Generate(BO.Session.DataLayer, BO.[GetType]().FullName, "ERP"), "00000000")
  47    End If
  48    Else
  49    FBCODE = Format(DistributedIdGeneratorHelper.Generate(BO.Session.DataLayer, BO.[GetType]().FullName, "ERP"), "00000000")
  50
  51    End If
  52    Return FBCODE
  53    End Function
  54
  3.调用方法代码
  调用方法代码
  1    Public Overloads Overrides Sub AfterConstruction()Sub AfterConstruction()
  2    MyBase.AfterConstruction()
  3    FBILLCODE = UPDATEBILLCODE(FBILLCODE, Me)
  4    BKBILLCODE = FBILLCODE
  5
  6    End Sub
  7   Private FBILLCODE As String
  8    <Indexed(unique:=True), DevExpress.Xpo.DisplayName("单据编号")> _
  9    <VisibleInListView(True)> _
  10    Public Property BILLCODE()Property BILLCODE() As String
  11    Get
  12    Return FBILLCODE
  13    End Get
  14    Set(ByVal value As String)
  15    SetPropertyValue("BILLCODE", FBILLCODE, value)
  16    End Set
  17    End Property

上一页  [1] [2] 

责任编辑:小草

文章搜索:
 相关文章
热点资讯
资讯快报
热门课程培训