ProductsGant vol2
This commit is contained in:
@@ -1,27 +1,17 @@
|
||||
Imports System
|
||||
Imports System.ComponentModel
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Diagnostics
|
||||
Imports System.Text
|
||||
Imports System.ComponentModel
|
||||
|
||||
Imports DevExpress.ExpressApp
|
||||
Imports DevExpress.ExpressApp.Actions
|
||||
Imports DevExpress.Persistent.Base
|
||||
Imports DevExpress.ExpressApp.Editors
|
||||
Imports exontrol.EXG2ANTTLib
|
||||
Imports DevExpress.Xpo
|
||||
Imports DevExpress.Data.Filtering
|
||||
Imports DevExpress.ExpressApp.SystemModule
|
||||
Imports DevExpress.Persistent.BaseImpl
|
||||
Imports System.Net.Mail
|
||||
Imports System.Reflection
|
||||
Imports DevExpress.ExpressApp.Utils
|
||||
Imports DevExpress.ExpressApp.Model
|
||||
Imports System.Linq
|
||||
|
||||
Public Class ProductsGant_VC
|
||||
Inherits Nuvolar.Module.ProductsGant_VC
|
||||
|
||||
|
||||
Dim _GanttControl As exontrol.EXG2ANTTLib.exg2antt
|
||||
Dim _ProductGandRowsOidindex As Long = 0
|
||||
Dim _GantItemColumn_Array As New ArrayList
|
||||
@@ -42,14 +32,14 @@ Public Class ProductsGant_VC
|
||||
Public Width As Long
|
||||
Public GantColumnIndex As Long
|
||||
End Structure
|
||||
|
||||
|
||||
#Region "Overrides"
|
||||
Protected Overrides Sub OnActivated()
|
||||
MyBase.OnActivated()
|
||||
|
||||
AddHandler DoWork, AddressOf _WaitFormClass.DoWork
|
||||
AddHandler InitWork, AddressOf _WaitFormClass.InitWork
|
||||
AddHandler FinalWork, AddressOf _WaitFormClass.Finalwork
|
||||
AddHandler InitWork, AddressOf _WaitFormClass.Initwork
|
||||
AddHandler FinalWork, AddressOf _WaitFormClass.FinalWork
|
||||
|
||||
If View.Id = "ProductsGant_DetailView" Then
|
||||
|
||||
@@ -73,8 +63,8 @@ Public Class ProductsGant_VC
|
||||
MyBase.OnDeactivated()
|
||||
|
||||
RemoveHandler DoWork, AddressOf _WaitFormClass.DoWork
|
||||
RemoveHandler InitWork, AddressOf _WaitFormClass.InitWork
|
||||
RemoveHandler FinalWork, AddressOf _WaitFormClass.Finalwork
|
||||
RemoveHandler InitWork, AddressOf _WaitFormClass.Initwork
|
||||
RemoveHandler FinalWork, AddressOf _WaitFormClass.FinalWork
|
||||
|
||||
If View.Id = "ProductsGant_DetailView" Then
|
||||
Frame.GetController(Of CloneObject.CloneObjectViewController)?.Active.SetItemValue("", True)
|
||||
@@ -127,9 +117,9 @@ Public Class ProductsGant_VC
|
||||
For Each _ProductsGantRowsBar As ProductsGantRowsBar In _ProductsGantRowsBar_Collection
|
||||
With _ProductsGantRowsBar
|
||||
If _ProductsGantRowsBar.ProductsGantRows.ManualRotation > 0 Then
|
||||
.ToDate = .FromDate.AddDays(_ProductsGantRowsBar.ProductsGantRows.ManualRotation)
|
||||
.ToDate = .FromDate.AddDays(_ProductsGantRowsBar.ProductsGantRows.ManualRotation * 7)
|
||||
ElseIf _ProductsGantRowsBar.ProductsGantRows.CalculatedRotation > 0 Then
|
||||
.ToDate = .FromDate.AddDays(_ProductsGantRowsBar.ProductsGantRows.CalculatedRotation)
|
||||
.ToDate = .FromDate.AddDays(_ProductsGantRowsBar.ProductsGantRows.CalculatedRotation * 7)
|
||||
Else
|
||||
.ToDate = .FromDate.AddDays(1)
|
||||
|
||||
@@ -316,7 +306,10 @@ Public Class ProductsGant_VC
|
||||
If Not String.IsNullOrEmpty(_GroupColumn.ColumnID) Then
|
||||
Select Case _GroupColumn.ColumnID
|
||||
Case "Customers"
|
||||
_WaitFormClass.Initwork(1, 1, _ProductsGant.ProductsGantRows.Count)
|
||||
For Each _ProductsGantRows As ProductsGantRows In _ProductsGant.ProductsGantRows
|
||||
_WaitFormClass.DoWork()
|
||||
|
||||
If _GroupObjects_Collection.Count = 0 Then
|
||||
_GroupObjects_Collection.Add(_ProductsGantRows.Customers)
|
||||
Else
|
||||
@@ -331,6 +324,7 @@ Public Class ProductsGant_VC
|
||||
If _Need Then _GroupObjects_Collection.Add(_ProductsGantRows.Customers)
|
||||
End If
|
||||
Next
|
||||
_WaitFormClass.FinalWork()
|
||||
|
||||
Dim _CustomerColumn As exontrol.EXG2ANTTLib.Column = Nothing
|
||||
For Each _G2Column As exontrol.EXG2ANTTLib.Column In _GanttControl.Columns
|
||||
@@ -346,14 +340,16 @@ Public Class ProductsGant_VC
|
||||
|
||||
_GanttControl.Items.set_CellValue(_GroupItem, _CustomerColumn.Index, "<b><fgcolor=0000FF>" + _Customers.FullName + "</fgcolor></b>")
|
||||
_GanttControl.Items.set_CellValueFormat(_GroupItem, _CustomerColumn.Index, ValueFormatEnum.exHTML)
|
||||
Dim _GroupCollectionElement_Collection As New XPCollection(Of ProductsGantRows)(_onew.Session, CriteriaOperator.Parse("Customers=? AND ProductsGant=?", _onew.GetObject(_Customers), _onew.GetObject(_ProductsGant)))
|
||||
|
||||
For Each _ProductsGantRows As ProductsGantRows In _GroupCollectionElement_Collection
|
||||
Dim _Item As Long = _GanttControl.Items.get_FindItem(_ProductsGantRows.Oid.ToString, 0)
|
||||
If _Item = 0 Then
|
||||
_Item = .Items.InsertItem(_GroupItem, "")
|
||||
.Items.set_ExpandItem(_Item, True)
|
||||
SetItemsAndItemData(_Item, _ProductsGantRows)
|
||||
|
||||
For Each _ProductsGantRows As ProductsGantRows In _ProductsGant.ProductsGantRows
|
||||
If _Customers.Oid = _ProductsGantRows.Customers.Oid Then
|
||||
Dim _Item As Long = _GanttControl.Items.get_FindItem(_ProductsGantRows.Oid.ToString, 0)
|
||||
If _Item = 0 Then
|
||||
_Item = .Items.InsertItem(_GroupItem, "")
|
||||
.Items.set_ExpandItem(_Item, True)
|
||||
SetItemsAndItemData(_Item, _ProductsGantRows)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
_GanttControl.Items.set_ExpandItem(_GroupItem, True)
|
||||
@@ -389,14 +385,15 @@ Public Class ProductsGant_VC
|
||||
Dim _GroupItem As Long = _GanttControl.Items.AddItem()
|
||||
_GanttControl.Items.set_CellValue(_GroupItem, _ProductsColumn.Index, _Products.ShortName)
|
||||
|
||||
Dim _GroupCollectionElement_Collection As New XPCollection(Of ProductsGantRows)(_onew.Session, CriteriaOperator.Parse("Products=? AND ProductsGant=?", _onew.GetObject(_Products), _onew.GetObject(_ProductsGant)))
|
||||
|
||||
For Each _ProductsGantRows As ProductsGantRows In _GroupCollectionElement_Collection
|
||||
Dim _Item As Long = _GanttControl.Items.get_FindItem(_ProductsGantRows.Oid.ToString, 0)
|
||||
If _Item = 0 Then
|
||||
_Item = _GanttControl.Items.InsertItem(_GroupItem, "")
|
||||
For Each _ProductsGantRows As ProductsGantRows In _ProductsGant.ProductsGantRows
|
||||
If _Products.Oid = _ProductsGantRows.Products.Oid Then
|
||||
Dim _Item As Long = _GanttControl.Items.get_FindItem(_ProductsGantRows.Oid.ToString, 0)
|
||||
If _Item = 0 Then
|
||||
_Item = _GanttControl.Items.InsertItem(_GroupItem, "")
|
||||
|
||||
SetItemsAndItemData(_Item, _ProductsGantRows)
|
||||
SetItemsAndItemData(_Item, _ProductsGantRows)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
@@ -500,8 +497,8 @@ Public Class ProductsGant_VC
|
||||
Select Case _G2Column.Key
|
||||
Case "ManualRotation"
|
||||
_ProductsGantRows.ManualRotation = _GanttControl.Items.get_CellValue(_GanttControl.Items.get_SelectedItem(0), _G2Column.Index)
|
||||
Case "CalculatedRotation"
|
||||
_ProductsGantRows.CalculatedRotation = _GanttControl.Items.get_CellValue(_GanttControl.Items.get_SelectedItem(0), _G2Column.Index)
|
||||
'Case "CalculatedRotation"
|
||||
' _ProductsGantRows.CalculatedRotation = _GanttControl.Items.get_CellValue(_GanttControl.Items.get_SelectedItem(0), _G2Column.Index)
|
||||
End Select
|
||||
Next
|
||||
|
||||
@@ -558,24 +555,24 @@ Public Class ProductsGant_VC
|
||||
|
||||
If _ProductsGantCustomersReport.QTT > 0 Then
|
||||
|
||||
Dim _ProductsGantCustomersReport_New As ProductsGantCustomersReport = _ocur.FindObject(Of ProductsGantCustomersReport)(CriteriaOperator.Parse("Customers=? AND Products=? AND DateExecution=?", _
|
||||
_ocur.GetObject(_ProductsGantCustomersReport.Customers), _
|
||||
_ocur.GetObject(_ProductsGantCustomersReport.Products), _
|
||||
Dim _ProductsGantCustomersReport_New As ProductsGantCustomersReport = _ocur.FindObject(Of ProductsGantCustomersReport)(CriteriaOperator.Parse("Customers=? AND Products=? AND DateExecution=?",
|
||||
_ocur.GetObject(_ProductsGantCustomersReport.Customers),
|
||||
_ocur.GetObject(_ProductsGantCustomersReport.Products),
|
||||
_ProductsGantCustomersReport.DateExecution))
|
||||
If _ProductsGantCustomersReport_New Is Nothing Then
|
||||
_ProductsGantCustomersReport_New = New ProductsGantCustomersReport(_ocur.Session)
|
||||
_ProductsGantCustomersReport_New.Customers = _ocur.GetObject(_ProductsGantCustomersReport.Customers)
|
||||
_ProductsGantCustomersReport_New.Products = _ocur.GetObject(_ProductsGantCustomersReport.Products)
|
||||
_ProductsGantCustomersReport_New.QTT = _ocur.GetObject(_ProductsGantCustomersReport.QTT)
|
||||
_ProductsGantCustomersReport_New.DateExecution = _ocur.GetObject(_ProductsGantCustomersReport.DateExecution)
|
||||
_ProductsGantCustomersReport_New.DateExecution = _ProductsGant.DateExecution
|
||||
End If
|
||||
|
||||
|
||||
Dim _ProductsGantRows As ProductsGantRows = _ocur.FindObject(Of ProductsGantRows)(CriteriaOperator.Parse("ProductsGant=? AND Customers.Oid=? AND Products.Oid=?", _
|
||||
|
||||
Dim _ProductsGantRows As ProductsGantRows = _ocur.FindObject(Of ProductsGantRows)(CriteriaOperator.Parse("ProductsGant=? AND Customers.Oid=? AND Products.Oid=?",
|
||||
_ProductsGant, _ProductsGantCustomersReport_New.Customers.Oid, _ProductsGantCustomersReport_New.Products.Oid))
|
||||
If _ProductsGantRows IsNot Nothing Then
|
||||
Dim _ProductsGantRowsBar As ProductsGantRowsBar = _ocur.FindObject(Of ProductsGantRowsBar) _
|
||||
(CriteriaOperator.Parse("ProductsGantRows.Oid=? AND GetDate(FromDate)=? AND BarType=2", _
|
||||
(CriteriaOperator.Parse("ProductsGantRows.Oid=? AND GetDate(FromDate)=? AND BarType=2",
|
||||
_ProductsGantRows.Oid, _ProductsGantCustomersReport.DateExecution.Date))
|
||||
If _ProductsGantRowsBar Is Nothing Then
|
||||
_ProductsGantRowsBar = New ProductsGantRowsBar(_ocur.Session)
|
||||
@@ -587,9 +584,9 @@ Public Class ProductsGant_VC
|
||||
.ToDate = .FromDate.AddDays(.ProductsGantRows.Products.CustomersOrderPriority(0).DeadlineWeek * 7)
|
||||
Else
|
||||
If _ProductsGantRowsBar.ProductsGantRows.CalculatedRotation > 0 Then
|
||||
.ToDate = .FromDate.AddDays(.ProductsGantRows.CalculatedRotation)
|
||||
.ToDate = .FromDate.AddDays(_ProductsGantRowsBar.ProductsGantRows.CalculatedRotation * 7)
|
||||
ElseIf _ProductsGantRowsBar.ProductsGantRows.ManualRotation > 0 Then
|
||||
.ToDate = .FromDate.AddDays(.ProductsGantRows.ManualRotation)
|
||||
.ToDate = .FromDate.AddDays(.ProductsGantRows.ManualRotation * 7)
|
||||
Else
|
||||
.ToDate = .FromDate.AddDays(1) 'temp
|
||||
End If
|
||||
@@ -605,9 +602,9 @@ Public Class ProductsGant_VC
|
||||
.ToDate = .FromDate.AddDays(.ProductsGantRows.Products.CustomersOrderPriority(0).DeadlineWeek * 7)
|
||||
Else
|
||||
If _ProductsGantRowsBar.ProductsGantRows.CalculatedRotation > 0 Then
|
||||
.ToDate = .FromDate.AddDays(.ProductsGantRows.CalculatedRotation)
|
||||
.ToDate = .FromDate.AddDays(_ProductsGantRowsBar.ProductsGantRows.CalculatedRotation * 7)
|
||||
ElseIf _ProductsGantRowsBar.ProductsGantRows.ManualRotation > 0 Then
|
||||
.ToDate = .FromDate.AddDays(.ProductsGantRows.ManualRotation)
|
||||
.ToDate = .FromDate.AddDays(.ProductsGantRows.ManualRotation * 7)
|
||||
Else
|
||||
.ToDate = .FromDate.AddDays(1) 'temp
|
||||
End If
|
||||
@@ -664,8 +661,8 @@ Public Class ProductsGant_VC
|
||||
|
||||
If Not String.IsNullOrEmpty(_ColumnID) Then
|
||||
Select Case _ColumnID
|
||||
Case "CalculatedRotation"
|
||||
_ProductsGantRows.CalculatedRotation = CType(NewValue, Double)
|
||||
'Case "CalculatedRotation"
|
||||
' _ProductsGantRows.CalculatedRotation = CType(NewValue, Double)
|
||||
Case "ManualRotation"
|
||||
_ProductsGantRows.ManualRotation = CType(NewValue, Double)
|
||||
End Select
|
||||
@@ -711,9 +708,14 @@ Public Class ProductsGant_VC
|
||||
Case "Products"
|
||||
_GanttControl.Items.set_CellValue(_Item, _G2Column.Index, _ProductsGantRows.Products.ShortName)
|
||||
Case "CalculatedRotation"
|
||||
_GanttControl.Items.set_CellValue(_Item, _G2Column.Index, _ProductsGantRows.CalculatedRotation)
|
||||
If _ProductsGantRows.CalculatedRotation > 0 Then
|
||||
_GanttControl.Items.set_CellValue(_Item, _G2Column.Index, _ProductsGantRows.CalculatedRotation)
|
||||
End If
|
||||
|
||||
Case "ManualRotation"
|
||||
_GanttControl.Items.set_CellValue(_Item, _G2Column.Index, _ProductsGantRows.ManualRotation)
|
||||
If _ProductsGantRows.ManualRotation > 0 Then
|
||||
_GanttControl.Items.set_CellValue(_Item, _G2Column.Index, _ProductsGantRows.ManualRotation)
|
||||
End If
|
||||
End Select
|
||||
|
||||
Next
|
||||
|
||||
Reference in New Issue
Block a user