split

来源:互联网 发布:window10和mac对比 编辑:程序博客网 时间:2024/05/07 22:44

  Private Sub Split_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

  Public Sub ShowScreen(ByVal strpLotID As String, ByVal strpOperationName As String)
    Dim oInDateTime As New InTrack_Automation.InDateTime
    Dim strComments As String = ""

    Try
      '** Make sure there is an active Intrack connection
      If oKIntrackDB.CheckIntrackConnection = 0 Then
        Exit Sub
      End If

      '** Reset errors
      oKErrors.ResetError()

            strpLotID = strpLotID.ToUpper
      '** Reset objects
      Me.cmbOperationName.Items.Clear()
      Me.txtLotID.ResetText()
      Me.txtNewLotID.ResetText()
      Me.txtQty.ResetText()
      Me.txtPriority.ResetText()
      Me.txtDueDate.ResetText()
      Me.txtComments.ResetText()

      ' Load Lot Key
      ObjInLot.LotKey = strpLotID
      iErrorNumber = ObjInLot.Load

      If iErrorNumber = 0 Then

        ' Load SubLot Key
        ObjInSubLot.SublotKey = SetSubLotKey(strpLotID, strpOperationName)
        iErrorNumber = ObjInSubLot.Load

        If iErrorNumber = 0 Then

          '** Pull information and set objects
          Me.cmbOperationName.Items.Add(strpOperationName)
          Me.cmbOperationName.SelectedIndex = 0
          Me.cmbOperationName.Enabled = False
          Me.txtLotID.Text = strpLotID
          Me.txtLotID.Enabled = False
          Me.txtPriority.Text = ObjInLot.Priority
          Me.txtQty.Text = ObjInSubLot.QueuedAmt.Quantity
          oInDateTime = ObjInLot.DueDate
          Me.txtDueDate.Text = Format(oInDateTime.date, "M/dd/yyyy HH:mm:ss")
          Me.txtComments.Text = strComments

          '** Clear comments
          ObjInSubLot.Comment(strComments)

          '** Assignation for check if perform Split Transaction for each Adjust Item
          sTmpLotID = Me.txtNewLotID.Text
          dblTmpQty = Me.txtQty.Text
          iTmpPriority = Me.txtPriority.Text
          sTmpDueDate = Me.txtDueDate.Text
          sTmpComments = Me.txtComments.Text

          Me.SBarSplit.Text = "Ready..."
          Windows.Forms.Application.DoEvents()
          Me.ShowDialog()

        End If
      End If

      '** Show error message if any
      If iErrorNumber <> 0 Then
        InDBConnect.GetErrorMessage(iErrorNumber, sErrorDescription)
        MsgBox(sErrorDescription, MsgBoxStyle.Exclamation)
      End If

    Catch ex As Exception
      MsgBox(ex.Message, MsgBoxStyle.Information, "SHOW_SCREEN_SPLIT")

    Finally
      oInDateTime = Nothing

    End Try

  End Sub

  Private Function MesSplit() As Integer
    Dim ObjInAmount As New InTrack_Automation.InAmount
    Dim ObjSecondaryInAmount As New InTrack_Automation.InAmount
    Dim ObjInDateTime As New InTrack_Automation.InDateTime
    Dim varDate As Object
    Dim varTime As Object

    Try

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

      varDate = Split(Mid$(txtDueDate.Text, 1, InStr(1, txtDueDate.Text, Chr(32))), "/")
      varTime = Split(Mid$(txtDueDate.Text, InStr(1, txtDueDate.Text, Chr(32)), 9), ":")

      intRetCode = ObjInDateTime.SetDateTime(varDate(0), varDate(1), varDate(2), varTime(0), varTime(1), varTime(2))
      If intRetCode <> 0 Then GoTo errHnd
      ObjInAmount.Quantity = txtQty.Text
      intRetCode = ObjInSubLot.Split(ObjInAmount, ObjSecondaryInAmount, txtNewLotID.Text, txtPriority.Text, ObjInDateTime)
      If intRetCode <> 0 Then GoTo errHnd
      If sTmpComments <> txtComments.Text Then
        If Len(Trim$(txtComments.Text)) > 0 Then intRetCode = ObjInSubLot.Comment(txtComments.Text)
        If intRetCode <> 0 Then GoTo errHnd
      End If

      InDBConnect.GetErrorMessage(intRetCode, strMsg)
      Me.SBarSplit.Text = strMsg
      MsgBox(strMsg, MsgBoxStyle.Information)
      Me.Close()
      MesSplit = 1
      Exit Function

errHnd:
      InDBConnect.GetErrorMessage(intRetCode, strMsg)
      MsgBox(strMsg, MsgBoxStyle.Exclamation)
      MesSplit = 0

    Catch ex As Exception
      MsgBox(ex.Message, MsgBoxStyle.Information, "SPLIT_TRANSACTION")

    Finally
      ObjInAmount = Nothing
      ObjSecondaryInAmount = Nothing
      ObjInDateTime = Nothing

      sTmpLotID = ""
      dblTmpQty = 0
      iTmpPriority = 0
      sTmpDueDate = ""
      sTmpComments = ""

    End Try
  End Function

  Private Sub lklblClose_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lklblClose.LinkClicked
    Me.Close()
  End Sub

  Private Sub btnSplit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSplit.Click
    Call MesSplit()
  End Sub

  Private Sub frmSplit_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Disposed
    ObjInLot = Nothing
    ObjInSubLot = Nothing
  End Sub

0 0
原创粉丝点击