402 lines
12 KiB
VB.net
402 lines
12 KiB
VB.net
Imports System.Globalization
|
|
Imports Newtonsoft.Json
|
|
Imports Newtonsoft.Json.Converters
|
|
Imports Effector.Plugin.FiveLakes.Door
|
|
|
|
Public Class JsonDoor
|
|
|
|
Private m_nListIndex As Integer
|
|
Public ReadOnly Property nListIndex As Integer
|
|
Get
|
|
Return m_nListIndex
|
|
End Get
|
|
End Property
|
|
|
|
Private m_nId As Integer
|
|
Public ReadOnly Property nId As Integer
|
|
Get
|
|
Return m_nId
|
|
End Get
|
|
End Property
|
|
|
|
Private m_nCSVLine As Integer
|
|
Public ReadOnly Property nCSVLine As Integer
|
|
Get
|
|
Return m_nCSVLine
|
|
End Get
|
|
End Property
|
|
|
|
Private m_sDDFName As String
|
|
Public ReadOnly Property sDDFName As String
|
|
Get
|
|
Return m_sDDFName
|
|
End Get
|
|
End Property
|
|
|
|
Private m_nQuantity As Integer
|
|
Public ReadOnly Property nQuantity As Integer
|
|
Get
|
|
Return m_nQuantity
|
|
End Get
|
|
End Property
|
|
|
|
Private m_dWidth As Double
|
|
Public ReadOnly Property dWidth As Double
|
|
Get
|
|
Return m_dWidth
|
|
End Get
|
|
End Property
|
|
|
|
Private m_dHeight As Double
|
|
Public ReadOnly Property dHeight As Double
|
|
Get
|
|
Return m_dHeight
|
|
End Get
|
|
End Property
|
|
|
|
Private m_dThickness As Double
|
|
Public ReadOnly Property dThickness As Double
|
|
Get
|
|
Return m_dThickness
|
|
End Get
|
|
End Property
|
|
|
|
Private m_sCSVName As String
|
|
Public ReadOnly Property sCSVName As String
|
|
Get
|
|
Return m_sCSVName
|
|
End Get
|
|
End Property
|
|
|
|
Private m_CustomerParameters As New List(Of CustomerParameter)
|
|
Public ReadOnly Property CustomerParameters As List(Of CustomerParameter)
|
|
Get
|
|
Return m_CustomerParameters
|
|
End Get
|
|
End Property
|
|
|
|
Private m_nState As DoorStates = DoorStates.LOADED_FROM_CSV
|
|
<JsonProperty>
|
|
<JsonConverter(GetType(StringEnumConverter))>
|
|
Public ReadOnly Property nState As DoorStates
|
|
Get
|
|
Return m_nState
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Statistics"
|
|
|
|
Private m_nProdState As DoorProdStates = DoorProdStates.NOT_INIT
|
|
<JsonProperty>
|
|
<JsonConverter(GetType(StringEnumConverter))>
|
|
Public ReadOnly Property nProdState As DoorProdStates
|
|
Get
|
|
Return m_nProdState
|
|
End Get
|
|
End Property
|
|
|
|
Private m_dtLoadTime As DateTime = DateTime.MinValue
|
|
Public ReadOnly Property dtLoadTime As DateTime
|
|
Get
|
|
Return m_dtLoadTime
|
|
End Get
|
|
End Property
|
|
|
|
Private m_dtMachining1Start As DateTime = DateTime.MinValue
|
|
Public ReadOnly Property dtMachining1Start As DateTime
|
|
Get
|
|
Return m_dtMachining1Start
|
|
End Get
|
|
End Property
|
|
|
|
Private m_dtMachining1End As DateTime = DateTime.MinValue
|
|
Public ReadOnly Property dtMachining1End As DateTime
|
|
Get
|
|
Return m_dtMachining1End
|
|
End Get
|
|
End Property
|
|
|
|
Private m_dtMachining2Start As DateTime = DateTime.MinValue
|
|
Public ReadOnly Property dtMachining2Start As DateTime
|
|
Get
|
|
Return m_dtMachining2Start
|
|
End Get
|
|
End Property
|
|
|
|
Private m_dtMachining2End As DateTime = DateTime.MinValue
|
|
Public ReadOnly Property dtMachining2End As DateTime
|
|
Get
|
|
Return m_dtMachining2End
|
|
End Get
|
|
End Property
|
|
|
|
Private m_dtUnloadTime As DateTime = DateTime.MinValue
|
|
Public ReadOnly Property dtUnloadTime As DateTime
|
|
Get
|
|
Return m_dtUnloadTime
|
|
End Get
|
|
End Property
|
|
|
|
#End Region ' Statistics
|
|
|
|
<JsonConstructor>
|
|
Sub New(nListIndex As Integer, nId As Integer, nCSVLine As Integer, sDDFName As String, sCSVName As String, nQuantity As Integer, dWidth As Double, dHeight As Double, dThickness As Double, nState As DoorStates, CustomerParameters As List(Of CustomerParameter),
|
|
nProdState As DoorProdStates, dtLoadTime As DateTime, dtMachining1Start As DateTime, dtMachining1End As DateTime, dtMachining2Start As DateTime, dtMachining2End As DateTime, dtUnloadTime As DateTime)
|
|
m_nListIndex = nListIndex
|
|
m_nId = nId
|
|
m_nCSVLine = nCSVLine
|
|
m_sDDFName = sDDFName
|
|
m_sCSVName = sCSVName
|
|
m_nQuantity = nQuantity
|
|
m_dHeight = dHeight
|
|
m_dWidth = dWidth
|
|
m_dThickness = dThickness
|
|
m_nState = nState
|
|
m_CustomerParameters = CustomerParameters
|
|
m_nProdState = nProdState
|
|
m_dtLoadTime = dtLoadTime
|
|
m_dtMachining1Start = dtMachining1Start
|
|
m_dtMachining1End = dtMachining1End
|
|
m_dtMachining2Start = dtMachining2Start
|
|
m_dtMachining2End = dtMachining2End
|
|
m_dtUnloadTime = dtUnloadTime
|
|
End Sub
|
|
|
|
Sub New(nListIndex As Integer, Door As Door)
|
|
m_nListIndex = nListIndex
|
|
m_nId = Door.nId
|
|
m_nCSVLine = Door.nCSVLine
|
|
m_sDDFName = Door.sDDFName
|
|
m_sCSVName = Door.sCSVName
|
|
m_nQuantity = Door.nQuantity
|
|
m_dHeight = Door.dHeight
|
|
m_dWidth = Door.dWidth
|
|
m_dThickness = Door.dThickness
|
|
m_nState = Door.nState
|
|
m_CustomerParameters = Door.CustomerParameters
|
|
m_nProdState = Door.nProdState
|
|
m_dtLoadTime = Door.dtLoadTime
|
|
m_dtMachining1Start = Door.dtMachining1Start
|
|
m_dtMachining1End = Door.dtMachining1End
|
|
m_dtMachining2Start = Door.dtMachining2Start
|
|
m_dtMachining2End = Door.dtMachining2End
|
|
m_dtUnloadTime = Door.dtUnloadTime
|
|
End Sub
|
|
|
|
End Class
|
|
|
|
Public Class JsonLuaDoor
|
|
Inherits VMBase
|
|
|
|
Private m_nId As Integer = -1
|
|
Public ReadOnly Property nId As Integer
|
|
Get
|
|
Return m_nId
|
|
End Get
|
|
End Property
|
|
|
|
Private m_nCircIndex As Integer = -1
|
|
Public ReadOnly Property nCircIndex As Integer
|
|
Get
|
|
Return m_nCircIndex
|
|
End Get
|
|
End Property
|
|
|
|
Private m_nState As Integer = 0
|
|
Public ReadOnly Property nState As Integer
|
|
Get
|
|
Return m_nState
|
|
End Get
|
|
End Property
|
|
|
|
Private m_DoorStateList As New List(Of IdNameStruct)({New IdNameStruct(0, "Not On Machine"),
|
|
New IdNameStruct(1, "Imported"),
|
|
New IdNameStruct(2, "On Load"),
|
|
New IdNameStruct(3, "On Machine 1"),
|
|
New IdNameStruct(4, "On Medium Station"),
|
|
New IdNameStruct(6, "On Machine 2"),
|
|
New IdNameStruct(7, "On Unload"),
|
|
New IdNameStruct(8, "Produced"),
|
|
New IdNameStruct(100, "Scrap")})
|
|
Public ReadOnly Property DoorStateList As List(Of IdNameStruct)
|
|
Get
|
|
Return m_DoorStateList
|
|
End Get
|
|
End Property
|
|
|
|
Private m_SelDoorState As IdNameStruct
|
|
Public Property SelDoorState As IdNameStruct
|
|
Get
|
|
Return m_SelDoorState
|
|
End Get
|
|
Set(value As IdNameStruct)
|
|
m_SelDoorState = value
|
|
End Set
|
|
End Property
|
|
|
|
Private m_sDoorCode As String = ""
|
|
Public ReadOnly Property sDoorCode As String
|
|
Get
|
|
Return m_sDoorCode
|
|
End Get
|
|
End Property
|
|
|
|
Private m_sDoorDescription As String = ""
|
|
Public ReadOnly Property sDoorDescription As String
|
|
Get
|
|
Return m_sDoorDescription
|
|
End Get
|
|
End Property
|
|
|
|
Private m_sDDFName As String = ""
|
|
Public ReadOnly Property sDDFName As String
|
|
Get
|
|
Return m_sDDFName
|
|
End Get
|
|
End Property
|
|
|
|
Private m_sCSVName As String = ""
|
|
Public ReadOnly Property sCSVName As String
|
|
Get
|
|
Return m_sCSVName
|
|
End Get
|
|
End Property
|
|
|
|
Private m_sM1CNPath As String = ""
|
|
Public ReadOnly Property sM1CNPath As String
|
|
Get
|
|
Return m_sM1CNPath
|
|
End Get
|
|
End Property
|
|
|
|
Private m_sM2CNPath As String = ""
|
|
Public ReadOnly Property sM2CNPath As String
|
|
Get
|
|
Return m_sM2CNPath
|
|
End Get
|
|
End Property
|
|
|
|
Private m_dtLoadTime As DateTime
|
|
Public ReadOnly Property sLoadTime As String
|
|
Get
|
|
Return m_dtLoadTime.ToString("yy/MM/dd HH:mm:ss")
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property dtLoadTime As DateTime
|
|
Get
|
|
Return m_dtLoadTime
|
|
End Get
|
|
End Property
|
|
|
|
Private m_dtMachining1Start As DateTime
|
|
Public ReadOnly Property sMachining1Start As String
|
|
Get
|
|
Return m_dtMachining1Start.ToString("yy/MM/dd HH:mm:ss")
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property dtMachining1Start As DateTime
|
|
Get
|
|
Return m_dtMachining1Start
|
|
End Get
|
|
End Property
|
|
|
|
Private m_dtMachining1End As DateTime
|
|
Public ReadOnly Property sMachining1End As String
|
|
Get
|
|
Return m_dtMachining1End.ToString("yy/MM/dd HH:mm:ss")
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property dtMachining1End As DateTime
|
|
Get
|
|
Return m_dtMachining1End
|
|
End Get
|
|
End Property
|
|
|
|
Private m_dtMachining2Start As DateTime
|
|
Public ReadOnly Property sMachining2Start As String
|
|
Get
|
|
Return m_dtMachining2Start.ToString("yy/MM/dd HH:mm:ss")
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property dtMachining2Start As DateTime
|
|
Get
|
|
Return m_dtMachining2Start
|
|
End Get
|
|
End Property
|
|
|
|
Private m_dtMachining2End As DateTime
|
|
Public ReadOnly Property sMachining2End As String
|
|
Get
|
|
Return m_dtMachining2End.ToString("yy/MM/dd HH:mm:ss")
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property dtMachining2End As DateTime
|
|
Get
|
|
Return m_dtMachining2End
|
|
End Get
|
|
End Property
|
|
|
|
Private m_dtUnloadTime As DateTime
|
|
Public ReadOnly Property sUnloadTime As String
|
|
Get
|
|
Return m_dtUnloadTime.ToString("yy/MM/dd HH:mm:ss")
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property dtUnloadTime As DateTime
|
|
Get
|
|
Return m_dtUnloadTime
|
|
End Get
|
|
End Property
|
|
|
|
<JsonConstructor>
|
|
Sub New(nId As Integer, nCircIndex As Integer, nState As Integer, sDoorCode As String, sDoorDescription As String, sDDFName As String, sCSVName As String,
|
|
sM1CNPath As String, sM2CNPath As String, nLoadTime As Long, nMachining1Start As Long, nMachining1End As Long, nMachining2Start As Long,
|
|
nMachining2End As Long, nUnloadTime As Long)
|
|
m_nId = nId
|
|
m_nCircIndex = nCircIndex
|
|
m_nState = nState
|
|
m_sDoorCode = sDoorCode
|
|
m_sDoorDescription = sDoorDescription
|
|
m_sDDFName = sDDFName
|
|
m_sCSVName = sCSVName
|
|
m_sM1CNPath = sM1CNPath
|
|
m_sM2CNPath = sM2CNPath
|
|
m_dtLoadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(nLoadTime).ToLocalTime()
|
|
m_dtMachining1Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(nMachining1Start).ToLocalTime()
|
|
m_dtMachining1End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(nMachining1End).ToLocalTime()
|
|
m_dtMachining2Start = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(nMachining2Start).ToLocalTime()
|
|
m_dtMachining2End = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(nMachining2End).ToLocalTime()
|
|
m_dtUnloadTime = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(nUnloadTime).ToLocalTime()
|
|
End Sub
|
|
|
|
Sub New(Door As Door)
|
|
m_nId = Door.nId
|
|
m_nCircIndex = 0
|
|
m_nState = 0
|
|
m_sDDFName = Door.sDDFName
|
|
m_sCSVName = Door.sCSVName
|
|
m_sM1CNPath = ""
|
|
m_sM2CNPath = ""
|
|
m_dtLoadTime = DateTime.MinValue
|
|
m_dtMachining1Start = DateTime.MinValue
|
|
m_dtMachining1End = DateTime.MinValue
|
|
m_dtMachining2Start = DateTime.MinValue
|
|
m_dtMachining2End = DateTime.MinValue
|
|
m_dtUnloadTime = DateTime.MinValue
|
|
End Sub
|
|
|
|
Friend Sub Update(JsonLuaDoor As JsonLuaDoor)
|
|
m_nCircIndex = JsonLuaDoor.m_nCircIndex
|
|
m_nState = JsonLuaDoor.m_nState
|
|
m_sM1CNPath = JsonLuaDoor.m_sM1CNPath
|
|
m_sM2CNPath = JsonLuaDoor.m_sM2CNPath
|
|
m_dtLoadTime = JsonLuaDoor.m_dtLoadTime
|
|
m_dtMachining1Start = JsonLuaDoor.m_dtMachining1Start
|
|
m_dtMachining1End = JsonLuaDoor.m_dtMachining1End
|
|
m_dtMachining2Start = JsonLuaDoor.m_dtMachining2Start
|
|
m_dtMachining2End = JsonLuaDoor.m_dtMachining2End
|
|
m_dtUnloadTime = JsonLuaDoor.m_dtUnloadTime
|
|
End Sub
|
|
|
|
End Class
|