consume

   Private Sub Consume_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim oTranslate As New Translate
        oTranslate.TranslateForm(Me)
        oTranslate = Nothing
    End Sub

    Private Sub ShowScreen()

        MsgBox("Under Consuruction", MsgBoxStyle.Information)
        Exit Sub

        Call SetListViews()
        Me.ShowDialog()
    End Sub

    Private Sub SetListViews()
        Dim oCustList As New CustListView

        oCustList.SetUp(Me.LstVwMaterialsToConsume, "Material to Consume|Quantity Needed|Unit of Measure")
        oCustList.SetUp(Me.LstVwMaterialInventory, "SubLot Key|Available Quantity|Consume Quantity")

        oCustList = Nothing

    End Sub

    Private Sub txtLotID_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtLotID.KeyPress
        Dim oInQuery As New InTrack_Automation.InQueryClass
        Dim iRetFlag As Integer = 0

        If Asc(e.KeyChar) = 13 Then

            iRetFlag = oInQuery.Query("Sublot", "*", "Where LotID = '" & Me.txtLotID.Text & "'")

            If iRetFlag = 0 Then
                Me.cmbRouteName.Items.Add("")
                Me.cmbOperationName.Items.Add("")
            End If

        End If

    End Sub

    Public Function SetExpirationDate(ByVal spLotID As String, ByVal spNewExpirationDate As Date)
        '
        Dim oInLot As New InTrack_Automation.InLot
        Dim oInDateTime As New InTrack_Automation.InDateTime
        '
        Dim bAllow As Boolean
        Dim iTmp1 As Long
        Dim iTmp2 As Long
        Dim sTmpDate As Date

        Try
            If oKIntrackDB.CheckIntrackConnection <> 1 Then
                Exit Function
            End If

            spLotID = spLotID.ToUpper
            oInLot.LotKey = spLotID
            iErrorNumber = oInLot.Load

            If iErrorNumber <> 0 Then
                InDBConnect.GetErrorMessage(iErrorNumber, sErrorDescription)
                Exit Function
            End If

            If IsDate(spNewExpirationDate) Then
                oInDateTime.SetMonthDayYear(spNewExpirationDate.Month, spNewExpirationDate.Day, spNewExpirationDate.Year)
                iErrorNumber = oInLot.SetExpirationDate(oInDateTime)
                If iErrorNumber <> 0 Then
                    InDBConnect.GetErrorMessage(iErrorNumber, sErrorDescription)
                    Exit Function
                End If

            End If

        Catch ex As Exception
            oKErrors.InternalErrorsHandler(ex, "Consume.SetExpirationDate")

        Finally
            oInLot = Nothing : oInDateTime = Nothing

        End Try

        Return IIf(iErrorNumber = 0, 1, 0)

    End Function


    'Public Function Consume(ByVal spSublotKey As String, ByVal spConsumeItems As String, _
    '                        Optional ByVal bpForceConsumption As Boolean = True, _
    '                        Optional ByVal spMachineName As String = "NONE") As Integer
    '    '
    '    Dim oInSublot As New InTrack_Automation.InSublot
    '    Dim oInPrmQty As New InTrack_Automation.InAmount
    '    Dim oInConsumeItems As New InTrack_Automation.InConsumeItems
    '    Dim oInConsumeItem As New InTrack_Automation.InConsumeItem
    '    '
    '    Dim iRow As Integer = 0
    '    Dim oLstConsume() As String
    '    Dim sConsumeLotID As String
    '    Dim dblConsumeQty As Double = 0
    '    Dim oMaterialQuantities() As String
    '    '
    '    Try

    '        oLstConsume = spConsumeItems.Split("|")
    '        oInSublot.SublotKey = spSublotKey

    '        iErrorNumber = oInSublot.Load

    '        If iErrorNumber <> 0 Then
    '            InDBConnect.GetErrorMessage(iErrorNumber, sErrorDescription)
    '            Exit Function
    '        End If

    '        For iRow = 0 To oLstConsume.Length - 1

    '            oMaterialQuantities = oLstConsume(iRow).Split(",")
    '            sConsumeLotID = oMaterialQuantities(0)
    '            dblConsumeQty = oMaterialQuantities(1)

    '            oInConsumeItem.Sublot = sConsumeLotID & "@NONE[NONE]:NONE"
    '            oInPrmQty.Quantity = dblConsumeQty
    '            oInConsumeItem.PrimaryAmt = oInPrmQty
    '            oInConsumeItem.MachineName = spMachineName
    '            oInConsumeItem.ForceConsumption = bpForceConsumption
    '            '
    '            iErrorNumber = oInSublot.Consume(oInConsumeItem)
    '            '
    '            If iErrorNumber <> 0 Then
    '                InDBConnect.GetErrorMessage(iErrorNumber, sErrorDescription)
    '                Exit Function
    '            End If
    '        Next

    '    Catch ex As Exception
    '        oKErrors.InternalErrorsHandler(ex, "Consume.Consume")

    '    Finally
    '        InDBConnect.Comment = ""
    '        oInSublot = Nothing : oInPrmQty = Nothing : oInConsumeItems = Nothing
    '        oInConsumeItem = Nothing

    '    End Try

    '    Return IIf(iErrorNumber = 0, 1, 0)

    'End Function

    Public Function Consume(ByVal spLotID As String, ByVal spOperationName As String, ByVal spConsumeItems As String, _
                            Optional ByVal bpForceConsumption As Boolean = True, _
                            Optional ByVal spMachineName As String = "NONE") As Integer
        '
        Dim oInSublot As New InTrack_Automation.InSublot
        Dim oInPrmQty As New InTrack_Automation.InAmount
        Dim oInConsumeItems As New InTrack_Automation.InConsumeItems
        Dim oInConsumeItem As New InTrack_Automation.InConsumeItem
        '
        Dim iRow As Integer = 0
        Dim oLstConsume() As String
        Dim sConsumeLotID As String
        Dim dblConsumeQty As Double = 0
        Dim oMaterialQuantities() As String
        '
        Try
            If oKIntrackDB.CheckIntrackConnection <> 1 Then
                Exit Function
            End If

            spLotID = spLotID.ToUpper

            oLstConsume = spConsumeItems.Split("|")
            oInSublot.SublotKey = SetSubLotKey(spLotID, spOperationName)

            iErrorNumber = oInSublot.Load

            If iErrorNumber <> 0 Then
                InDBConnect.GetErrorMessage(iErrorNumber, sErrorDescription)
                Exit Function
            End If

            For iRow = 0 To oLstConsume.Length - 1

                oMaterialQuantities = oLstConsume(iRow).Split(",")
                sConsumeLotID = oMaterialQuantities(0)
                dblConsumeQty = oMaterialQuantities(1)

                oInConsumeItem.Sublot = sConsumeLotID & "@NONE[NONE]:NONE"
                oInPrmQty.Quantity = dblConsumeQty
                oInConsumeItem.PrimaryAmt = oInPrmQty
                oInConsumeItem.MachineName = spMachineName
                oInConsumeItem.ForceConsumption = bpForceConsumption
                '
                iErrorNumber = oInSublot.Consume(oInConsumeItem)
                '
                If iErrorNumber <> 0 Then
                    InDBConnect.GetErrorMessage(iErrorNumber, sErrorDescription)
                    Exit Function
                End If
            Next

        Catch ex As Exception
            oKErrors.InternalErrorsHandler(ex, "Consume.Consume")

        Finally
            InDBConnect.Comment = ""
            oInSublot = Nothing : oInPrmQty = Nothing : oInConsumeItems = Nothing
            oInConsumeItem = Nothing

        End Try

        Return IIf(iErrorNumber = 0, 1, 0)

    End Function

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值