337 lines
14 KiB
VB.net
337 lines
14 KiB
VB.net
Imports System
|
|
Imports System.ComponentModel
|
|
Imports DevExpress.Xpo
|
|
Imports DevExpress.Data.Filtering
|
|
Imports DevExpress.ExpressApp
|
|
Imports DevExpress.Persistent.Base
|
|
Imports DevExpress.Persistent.BaseImpl
|
|
Imports DevExpress.Persistent.Validation
|
|
|
|
Imports DevExpress.ExpressApp.ConditionalAppearance
|
|
Public Enum eOutMode
|
|
eProducts = 0
|
|
ePacketNumber = 1
|
|
eSerialNumber = 2
|
|
End Enum
|
|
|
|
'<EditorStateRule("Disable properties when IsEditable = False", "*", ViewType.DetailView, "IsEditable = False", EditorState.Disabled)> _
|
|
'<EditorStateRuleAttribute("Disable DocumentNumber all time StorageOutHeader", "DocumentNumber", ViewType.DetailView, "1=1", EditorState.Disabled)> _
|
|
|
|
<DefaultClassOptions()> _
|
|
<NavigationItem("StorageTransactions")> _
|
|
<Appearance("Hide row_StorageInRows properties when row_OutMode=0", AppearanceItemType.ViewItem, "row_OutMode=0", TargetItems:="row_StorageInRows", visibility:=Editors.ViewItemVisibility.Hide)> _
|
|
<Appearance("Hide row_StorageComputed properties when row_OutMode<>0", AppearanceItemType.ViewItem, "row_OutMode<>0", TargetItems:="row_StorageComputed", visibility:=Editors.ViewItemVisibility.Hide)> _
|
|
<Appearance("Hide row_ properties when IsEditable=False", AppearanceItemType.ViewItem, "IsEditable=False", TargetItems:="row_OutMode;row_QTT;row_QTT_Will;row_StorageComputed;row_StorageInRows", visibility:=Editors.ViewItemVisibility.Hide)> _
|
|
<Appearance("Disable properties when IsEditable = False", TargetItems:="*", Criteria:="IsEditable = False", Enabled:=False, Context:="DetailView")> _
|
|
<Appearance("Disable DocumentNumber all time StorageOutHeader", TargetItems:="DocumentNumber", Criteria:="1=1", Enabled:=False, Context:="DetailView")> _
|
|
<Appearance("Hide Row Data", AppearanceItemType.LayoutItem, "IsEditable = False", TargetItems:="Item1", visibility:=Editors.ViewItemVisibility.Hide)> _
|
|
<Appearance("Hide Item3 StorageOutHeader", AppearanceItemType.LayoutItem, "IsNull(Storage) Or IsNull(DocumentNumber) Or IsNull(CustomersFrom) Or IsNull(StorageMoveType) Or IsNull(Customers)", TargetItems:="Item3", visibility:=Editors.ViewItemVisibility.Hide)> _
|
|
<Appearance("Disable Storage, CustomersFrom, StorageMoveType when IsFinalized=True", AppearanceItemType.ViewItem, "IsFinalized=True", TargetItems:="Storage;CustomersFrom;StorageMoveType", Enabled:=False)> _
|
|
<Appearance("Hide StorageTo property when StorageMoveType.MoveType<>6", AppearanceItemType.ViewItem, "StorageMoveType.MoveType<>6", TargetItems:="StorageTo", visibility:=Editors.ViewItemVisibility.Hide)> _
|
|
<Appearance("Disable Customers property when StorageMoveType.MoveType=6", AppearanceItemType.ViewItem, "StorageMoveType.MoveType=6", TargetItems:="Customers", Enabled:=False)> _
|
|
Public Class StorageOutHeader
|
|
Inherits BaseObject
|
|
Private _StorageMoveType As StorageMoveType
|
|
Private _CustomersFrom As CustomersFrom
|
|
Private _Customers As Customers
|
|
Private _DocumentNumber As String
|
|
Private _Storage As Storage
|
|
Private _StorageTo As Storage
|
|
Private _CreateDate As Date
|
|
Private _Active As Boolean = True
|
|
Private _ObjectCreated As Date
|
|
Private _UserCreated As User 'Ki készítette
|
|
Private _IsStorno As Boolean = False
|
|
Private _IsEditable As Boolean = True
|
|
Private _IsFinalized As Boolean = False 'Volt-e már véglegesítve ?
|
|
Private _RecipeExecutionSimple As RecipeExecutionSimple 'Melyik gyártáshoz kapcs. kitárolás
|
|
Private _WorkSheet_Header As WorkSheet_Header 'Melyik munkalaphoz kapcsolódik a kitárolás
|
|
Private _StoragePDACollectionHeader As StoragePDACollectionHeader
|
|
Private _ConnectInfo As String
|
|
|
|
'----------------------------------------------------------------------------
|
|
Private _row_OutMode As eOutMode
|
|
Private _row_QTT As Double
|
|
Private _row_QTT_Will As Double
|
|
Private _row_StorageComputed As StorageComputed
|
|
Private _row_StorageInRows As StorageInRows
|
|
'----------------------------------------------------------------------------
|
|
Public Sub New(ByVal session As Session)
|
|
MyBase.New(session)
|
|
End Sub
|
|
Public Overrides Sub AfterConstruction()
|
|
MyBase.AfterConstruction()
|
|
CreateDate = GetSQLTime(Session)
|
|
End Sub
|
|
Protected Overrides Sub OnSaving()
|
|
MyBase.OnSaving()
|
|
If String.IsNullOrEmpty(DocumentNumber) Then
|
|
_DocumentNumber = _Storage.NumberGeneratorOut.GetNewNumber(_Storage.NumberGeneratorOut)
|
|
End If
|
|
If Session.IsNewObject(Me) Then
|
|
ObjectCreated = GetSQLTime(Session)
|
|
UserCreated = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser))
|
|
End If
|
|
End Sub
|
|
|
|
<RuleRequiredField("StorageOutHeader-StorageMoveType", DefaultContexts.Save)>
|
|
<ImmediatePostData(True), DataSourceCriteria("Storage='@This.Storage' and MoveDirection=1")>
|
|
Property StorageMoveType As StorageMoveType
|
|
Get
|
|
Return _StorageMoveType
|
|
End Get
|
|
Set(value As StorageMoveType)
|
|
SetPropertyValue("StorageMoveType", _StorageMoveType, value)
|
|
End Set
|
|
End Property
|
|
Property CustomersFrom As CustomersFrom
|
|
Get
|
|
Return _CustomersFrom
|
|
End Get
|
|
Set(ByVal value As CustomersFrom)
|
|
SetPropertyValue("CustomersFrom", _CustomersFrom, value)
|
|
End Set
|
|
End Property
|
|
<ImmediatePostData()>
|
|
Property Customers As Customers
|
|
Get
|
|
Return _Customers
|
|
End Get
|
|
Set(ByVal value As Customers)
|
|
SetPropertyValue("Customres", _Customers, value)
|
|
End Set
|
|
End Property
|
|
Property DocumentNumber() As String
|
|
Get
|
|
Return _DocumentNumber
|
|
End Get
|
|
Set(ByVal value As String)
|
|
SetPropertyValue("DocumentNumber", _DocumentNumber, value)
|
|
End Set
|
|
End Property
|
|
<RuleRequiredField("", DefaultContexts.Save)>
|
|
<ImmediatePostData(True), DataSourceCriteria("CustomersFrom = '@This.CustomersFrom'")>
|
|
Property Storage() As Storage
|
|
Get
|
|
Return _Storage
|
|
End Get
|
|
Set(ByVal value As Storage)
|
|
SetPropertyValue("Storage", _Storage, value)
|
|
If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving Then
|
|
If StorageMoveType IsNot Nothing Then
|
|
If StorageMoveType.MoveType = eMoveType.InventoryTransfer Then
|
|
Customers = value.CustomersFrom
|
|
End If
|
|
End If
|
|
End If
|
|
End Set
|
|
End Property
|
|
<ImmediatePostData(True), DataSourceCriteria("CustomersFrom = '@This.CustomersFrom'")>
|
|
<RuleRequiredField("StorageOutHeader - StorageTo", DefaultContexts.Save, TargetCriteria:="StorageMoveType.MoveType=6")>
|
|
Property StorageTo As Storage
|
|
Get
|
|
Return _StorageTo
|
|
End Get
|
|
Set(value As Storage)
|
|
SetPropertyValue("StorageTo", _StorageTo, value)
|
|
If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving Then
|
|
If StorageMoveType.MoveType = eMoveType.InventoryTransfer Then
|
|
If value Is Nothing Then
|
|
Customers = Nothing
|
|
Else
|
|
Customers = value.CustomersFrom
|
|
End If
|
|
End If
|
|
End If
|
|
End Set
|
|
End Property
|
|
|
|
Property CreateDate() As Date
|
|
Get
|
|
Return _CreateDate
|
|
End Get
|
|
Set(ByVal value As Date)
|
|
SetPropertyValue("CreateDate", _CreateDate, value)
|
|
End Set
|
|
End Property
|
|
Property Active() As Boolean
|
|
Get
|
|
Return _Active
|
|
End Get
|
|
Set(ByVal value As Boolean)
|
|
SetPropertyValue("Active", _Active, value)
|
|
End Set
|
|
End Property
|
|
<NonCloneable>
|
|
Property ObjectCreated() As Date
|
|
Get
|
|
Return _ObjectCreated
|
|
End Get
|
|
Set(ByVal value As Date)
|
|
SetPropertyValue("ObjectCreated", _ObjectCreated, value)
|
|
End Set
|
|
End Property
|
|
<NonCloneable>
|
|
Property UserCreated As User
|
|
Get
|
|
Return _UserCreated
|
|
End Get
|
|
Set(value As User)
|
|
SetPropertyValue("UserCreated", _UserCreated, value)
|
|
End Set
|
|
End Property
|
|
Property IsStorno() As Boolean
|
|
Get
|
|
Return _IsStorno
|
|
End Get
|
|
Set(ByVal value As Boolean)
|
|
SetPropertyValue("IsStorno", _IsStorno, value)
|
|
End Set
|
|
End Property
|
|
Property IsEditable() As Boolean
|
|
Get
|
|
Return _IsEditable
|
|
End Get
|
|
Set(ByVal value As Boolean)
|
|
SetPropertyValue("IsEditable", _IsEditable, value)
|
|
End Set
|
|
End Property
|
|
<Browsable(False)>
|
|
Property IsFinalized As Boolean
|
|
Get
|
|
Return _IsFinalized
|
|
End Get
|
|
Set(value As Boolean)
|
|
SetPropertyValue("IsFinalized", _IsFinalized, value)
|
|
End Set
|
|
End Property
|
|
|
|
Property RecipeExecutionSimple As RecipeExecutionSimple
|
|
Get
|
|
Return _RecipeExecutionSimple
|
|
End Get
|
|
Set(value As RecipeExecutionSimple)
|
|
SetPropertyValue("RecipeExecutionSimple", _RecipeExecutionSimple, value)
|
|
End Set
|
|
End Property
|
|
<ImmediatePostData(True), DataSourceCriteria("CustomersFrom='@This.CustomersFrom' and Customers='@This.Customers' and WorkSheetState<>1")>
|
|
Property WorkSheet_Header As WorkSheet_Header
|
|
Get
|
|
Return _WorkSheet_Header
|
|
End Get
|
|
Set(value As WorkSheet_Header)
|
|
SetPropertyValue("WorkSheet_Header", _WorkSheet_Header, value)
|
|
End Set
|
|
End Property
|
|
Property StoragePDACollectionHeader As StoragePDACollectionHeader
|
|
Get
|
|
Return _StoragePDACollectionHeader
|
|
End Get
|
|
Set(value As StoragePDACollectionHeader)
|
|
SetPropertyValue("StoragePDACollectionHeader", _StoragePDACollectionHeader, value)
|
|
End Set
|
|
End Property
|
|
Property ConnectInfo As String
|
|
Get
|
|
Return _ConnectInfo
|
|
End Get
|
|
Set(value As String)
|
|
SetPropertyValue("ConnectInfo", _ConnectInfo, value)
|
|
End Set
|
|
End Property
|
|
|
|
'Nonpersistent
|
|
<NonPersistent()>
|
|
<ImmediatePostData()>
|
|
Property row_OutMode As eOutMode
|
|
Get
|
|
Return _row_OutMode
|
|
End Get
|
|
Set(value As eOutMode)
|
|
SetPropertyValue("row_OutMode", _row_OutMode, value)
|
|
End Set
|
|
End Property
|
|
<NonPersistent()>
|
|
<VisibleInListView(False)>
|
|
Property row_QTT() As Double
|
|
Get
|
|
Return _row_QTT
|
|
End Get
|
|
Set(ByVal value As Double)
|
|
SetPropertyValue("Row_QTT", _row_QTT, value)
|
|
End Set
|
|
End Property
|
|
<NonPersistent()>
|
|
<RuleRange("StorageOutHeader-row_QTT_Will", "aToTable_StorageOut_Context", 0.0001, Double.MaxValue, TargetCriteria:="IsEditable=True")>
|
|
<VisibleInListView(False)>
|
|
Property row_QTT_Will() As Double
|
|
Get
|
|
Return _row_QTT_Will
|
|
End Get
|
|
Set(ByVal value As Double)
|
|
SetPropertyValue("Row_QTT_Will", _row_QTT_Will, value)
|
|
End Set
|
|
End Property
|
|
<NonPersistent()>
|
|
<ImmediatePostData(True), DataSourceCriteria("Storage = '@This.Storage'")>
|
|
<RuleRequiredField("StorageOutHeader-row_StorageComputed", "aToTable_StorageOut_Context", TargetCriteria:="row_OutMode=0")>
|
|
<VisibleInListView(False)>
|
|
Property row_StorageComputed() As StorageComputed
|
|
Get
|
|
Return _row_StorageComputed
|
|
End Get
|
|
Set(ByVal value As StorageComputed)
|
|
SetPropertyValue("Row_StorageComputed", _row_StorageComputed, value)
|
|
End Set
|
|
End Property
|
|
<NonPersistent()>
|
|
<ImmediatePostData(True), DataSourceCriteria("StorageInHeader.Storage = '@This.Storage' and QTT>QTT_Out")>
|
|
<RuleRequiredField("StorageOutHeader-row_StorageInRows", "aToTable_StorageOut_Context", targetcriteria:="row_OutMode<>0")> _
|
|
<VisibleInListView(False)> _
|
|
Property row_StorageInRows As StorageInRows
|
|
Get
|
|
Return _row_StorageInRows
|
|
End Get
|
|
Set(value As StorageInRows)
|
|
SetPropertyValue("row_StorageInRows", _row_StorageInRows, value)
|
|
End Set
|
|
End Property
|
|
|
|
'XPCollections
|
|
<VisibleInListView(False)> _
|
|
<Association("StorageOut", GetType(StorageOutRows))> _
|
|
Public ReadOnly Property StorageOutRows() As XPCollection(Of StorageOutRows)
|
|
Get
|
|
Return GetCollection(Of StorageOutRows)("StorageOutRows")
|
|
End Get
|
|
End Property
|
|
<VisibleInListView(False), VisibleInLookupListView(False)> _
|
|
ReadOnly Property StorageOutRowsInRows As XPCollection(Of StorageOutRowsInRows)
|
|
Get
|
|
Dim _StorageOutRowsInRows_Collection As New XPCollection(Of StorageOutRowsInRows)(Session, CriteriaOperator.Parse("1=2"))
|
|
Dim _StorageOutRows As StorageOutRows
|
|
Dim _StorageOutRowsInRows As StorageOutRowsInRows
|
|
For Each _StorageOutRows In Me.StorageOutRows
|
|
For Each _StorageOutRowsInRows In _StorageOutRows.StorageOutRowsInRows
|
|
_StorageOutRowsInRows_Collection.Add(_StorageOutRowsInRows)
|
|
Next
|
|
Next
|
|
Return _StorageOutRowsInRows_Collection
|
|
End Get
|
|
End Property
|
|
<VisibleInListView(False), VisibleInLookupListView(False)> _
|
|
ReadOnly Property StorageInRows As XPCollection(Of StorageInRows)
|
|
Get
|
|
Dim _StorageInRows_Collection As New XPCollection(Of StorageInRows)(Session, CriteriaOperator.Parse("1=2"))
|
|
Dim _StorageOutRows As StorageOutRows
|
|
Dim _StorageOutRowsInRows As StorageOutRowsInRows
|
|
For Each _StorageOutRows In Me.StorageOutRows
|
|
For Each _StorageOutRowsInRows In _StorageOutRows.StorageOutRowsInRows
|
|
_StorageInRows_Collection.Add(_StorageOutRowsInRows.StorageInRows)
|
|
Next
|
|
Next
|
|
Return _StorageInRows_Collection
|
|
End Get
|
|
End Property
|
|
End Class
|