Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub FctProcessProducts()
- On Error GoTo errorhandler
- '
- Dim recBuffer As New ADODB.recordSet
- Dim strSqlBuffer As String
- Dim strStatusboxpicker As String
- Dim strProductsNotBrought As String
- Dim blnAtLeast1productNotBrought As Boolean
- Dim strSqlUpdateLocatie As String
- Dim strsqlDelete205 As String
- '1 x products are being brought
- intTobeBrought = fktRecordCounterExtended("select count(*) as Totaal from tblbuffer where statusboxpicker = " & enumBoxpickerStatus.PickRequest & " or statusboxpicker = " & enumBoxpickerStatus.PickInProgress)
- lblInformativeText.Caption = GetTxt("UZGentProductsBeingBrought1") & " " & intTobeBrought & " " & GetTxt("UZGentProductsBeingBrought2")
- '2 x product could not be delivered
- 'TBU UZGentRobot
- If gcnExtendedConnection.State = adStateClosed Then
- Call FctCreateDBConnection_Extended
- End If
- strSqlBuffer = "select count(*) as Totaal,Article,Description from tblbuffer where outputchannel =" & gstrMediTech_ChannelOutput & " and statusboxpicker = " & enumBoxpickerStatus.PickNotInBoxpicker & " group by article, Description"
- recBuffer.Open strSqlBuffer, gcnExtendedConnection, adOpenStatic, adLockReadOnly, adCmdText
- '
- If Not (recBuffer.EOF And recBuffer.BOF) Then
- Do While recBuffer.EOF = False
- If (strProductsNotBrought = "") Then
- strProductsNotBrought = GetTxt("UzGentProductsNotBrought1") & " " & recBuffer!Description & " " & GetTxt("UzGentProductsNotBrought2") & " " & recBuffer!Totaal & " " & GetTxt("UzGentProductsNotBrought3")
- Else
- strProductsNotBrought = strProductsNotBrought & vbNewLine & GetTxt("UzGentProductsNotBrought1") & " " & recBuffer!Description & " " & GetTxt("UzGentProductsNotBrought2") & " " & recBuffer!Totaal & " " & GetTxt("UzGentProductsNotBrought3")
- End If
- blnAtLeast1productNotBrought = True
- recBuffer.MoveNext
- Loop
- End If
- lblErrorInfo.Caption = strProductsNotBrought
- recBuffer.Close
- '3 message to go to balie
- If (blnAtLeast1productNotBrought) Then
- If gblnSwitchToDoctor Then
- lblErrorOccurred.Caption = GetTxt("DoctorErrorMsg")
- Else
- lblErrorOccurred.Caption = GetTxt("UzGentProductsNotBroughtBalie")
- End If
- End If
- '4 Process delivered boxes
- If gcnExtendedConnection.State = adStateClosed Then
- Call FctCreateDBConnection_Extended
- End If
- strSqlBuffer = "select article,location,Quantity,description,ArtikelCode,Packid from tblbuffer where outputchannel =" & gstrMediTech_ChannelOutput & " and statusboxpicker = " & enumBoxpickerStatus.PickExecuted
- recBuffer.Open strSqlBuffer, gcnExtendedConnection, adOpenStatic, adLockReadOnly, adCmdText
- '
- If Not (recBuffer.EOF And recBuffer.BOF) Then
- Do While recBuffer.EOF = False
- If IsNull(recBuffer!Artikelcode) Then
- strArtikleCode = recBuffer!Article
- Else
- strArtikleCode = recBuffer!Artikelcode
- End If
- '
- strSqlUpdateLocatie = "update locations set Article = NULL, lotnbr = NULL, reserved = 0, Stock = 0, Trans_date = NULL, Inventory = NULL, Vervaldatum = NULL, Containernr = NULL, HcStatus = 1, PackID = NULL where location ='" & recBuffer!location & "'"
- '
- If gcnExtendedConnection.State = adStateClosed Then
- Call FctCreateDBConnection_Extended
- End If
- '
- gcnExtendedConnection.Execute strSqlUpdateLocatie
- 'Marian B. UZGentRobot history
- Call FctWriteToHistory_RobotMutation("Robot.Out", 0 - recBuffer!Quantity, "0", strArtikleCode, "Volle verpakking ophalen.")
- recBuffer.MoveNext
- Loop
- End If
- '5 delete 205 lines (already processed)
- If gcnExtendedConnection.State = adStateClosed Then
- Call FctCreateDBConnection_Extended
- End If
- strsqlDelete205 = "Delete from tblbuffer where (statusboxpicker = " & enumBoxpickerStatus.PickExecuted & ") and outputchannel = " & gstrMediTech_ChannelOutput
- gcnExtendedConnection.Execute strsqlDelete205
- '
- Exit Sub
- '
- errorhandler:
- Select Case FctShowErrorBox("frmPatientPickList.frm", "FctProcessProducts")
- Case vbAbort
- Case vbRetry: Resume
- Case vbIgnore: Resume Next
- End Select
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement