Resource temporarily unavailable

Post your Gambas programming questions here.
Post Reply
AndyGable
Posts: 234
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Resource temporarily unavailable

Post by AndyGable »

Hi Everyone

I hope someone can help

I am trying to print a End of day report to my Point of sale Printer but I keep getting "Resource temporarily unavailable" while it is printing

This is what I am using to print to the printer

Private Sub PrintOnPrinter(DataToPrint As String)
    Dim LineData As String
    Dim TempDataPrint As String = Null
    Dim i As Integer = 0
    
    Print Global.LineCount
    
    If Global.LineCount > 100 Then 
        Global.DataReadIn = Split(DataToPrint, "~")
        
        For Each LineData In Global.DataReadIn
            TempDataPrint &= LineData & PrinterNewLine
            i += 1
   
       If i = 10 Then
                Try Write #Global.PrinterPort, TempDataPrint
                Global.PrinterPort.Send  
                 i = 0
                TempDataPrint = Null
            End If
        Next        
    Else
        Try Write #Global.PrinterPort, DataToPrint
        Global.PrinterPort.Send  
    End If
    
    Feed_CutPaper(Global.LinesToFeed)
End


What I am trying todo is get 100 lines Ready to be sent to the printer and then send them and then wait 0.1 second and send another 100 or what ever is remaining but I can not get that to work (as you can see I have been trying to only send 10 lines at a time but nothing is working am i not working spliting the data correct? (it ends with a ~)

anything under 100 lines are printing with no issues. The report is 142 lines

Below is the dump from my PoS appliation to the Printer module

|L|1--------------------------------------------------------~
|C|B4END OF DAY~
|C|B1WEDNESDAY~
|L|1--------------------------------------------------------~
|L|1Cash in drawer~
|L|1~|L|B3Notes~
|L|1--------------------------------------------------------~
|L|B1VALUE              QTY              TOTAL~
|L|B1 £5.00              0               £0.00~
|L|B1£10.00              0               £0.00~
|L|B1£20.00              0               £0.00~
|L|B1£50.00              0               £0.00~
|L|1--------------------------------------------------------~
|R|B3Note Total £0.00 ~
|L|1~|L|B3Coins~
|L|1--------------------------------------------------------~
|L|B1VALUE              QTY              TOTAL~
|L|B1 £2.00              0               £0.00~
|L|B1 £1.00              0               £0.00~
|L|B1 £0.50              0               £0.00~
|L|B1 £0.20              0               £0.00~
|L|B1 £0.10              0               £0.00~
|L|B1 £0.05              0               £0.00~
|L|B1 £0.02              0               £0.00~
|L|B1 £0.01              0               £0.00~
|L|1--------------------------------------------------------~
|R|B3Coin Total £0.00 ~
|L|1~
|L|B3Tender Summary~
|L|1--------------------------------------------------------~|
R|B1User Total £0.00 ~
|R|B1SYSTEM Cash in Draw £0.00 ~
|L|1~|R|B1SYSTEM TOTAL £0.00 ~
|L|1~|C|B4Cash drawer~
|C|B4Balanaced~
|L|1~
|L|B3Lottery Summary~
|L|1--------------------------------------------------------
~|C|1** THIS REPORT IS ONLY FOR THIS TERMINAL **~
|L|B1  NATIONAL LOTTERY                  £0.00~
|L|B1     EURO MILLIONS                  £0.00~
|L|B1      SET FOR LIFE                  £0.00~
|L|B1       THUNDERBALL                  £0.00~
|L|B1   LOTTO HOT PICKS                  £0.00~
|L|1~|L|B1      SCRACH CARDS                  £0.00~
|L|1--------------------------------------------------------~|
R|B3Lottery Total £0.00 ~
|L|B3PoS Summary~
|L|1--------------------------------------------------------~
|L|1~
|L|B3Sales~
|L|1--------------------------------------------------------~
|L|B1TENDER TYPE                         TOTAL~
|L|B1              CASH                  £0.00~
|L|B1              CARD                  £0.00~
|L|B1           COUPONS                  £0.00~
|L|B1        GIFT CARDS                  £0.00~
|L|B1     GIFT VOUCHERS                  £0.00~
|L|B1            CHEQUE                  £0.00~
|L|B1        ON ACCOUNT                  £0.00~
|L|1--------------------------------------------------------~
|R|B3Sales Total £0.00 ~
|L|1~
|L|B3Refunds~
|L|1--------------------------------------------------------~
|L|B1TENDER TYPE                         TOTAL~
|L|B1              CASH                  £0.00~
|L|B1              CARD                  £0.00~
|L|B1           COUPONS                  £0.00~
|L|B1        GIFT CARDS                  £0.00~
|L|B1     GIFT VOUCHERS                  £0.00~
|L|B1            CHEQUE                  £0.00~
|L|B1        ON ACCOUNT                  £0.00~
|L|1--------------------------------------------------------~
|R|B3Refunds Total £0.00 ~
|L|1~
|L|B3Float Summary~
|L|1--------------------------------------------------------~
|L|B1          FLOAT IN                  £0.00~
|L|B1         FLOAT OUT                  £0.00~
|L|1--------------------------------------------------------~
|R|B3Differance  £0.00 ~
|L|1~|L|B3PoS Summary~
|L|1--------------------------------------------------------~
|L|B1    CUSTOMER COUNT                      0 ~
|L|B1     NO SALE COUNT                      0 ~
|L|B1 TOTAL VOIDS COUNT                      0 ~
|L|B1 TOTAL VOIDS VALUE                  £0.00~
|L|1~
|L|B1   SAFE DROP VALUE                  £0.00~
|L|1~
|L|B3Terminal Total~
|L|1--------------------------------------------------------~
|R|B4£0.00~
|L|1
~|L|B3Safe Drop Summary~
|L|1--------------------------------------------------------~
|L|1~
|L|B1Drop Date : 10/09/2022~
|L|120:42 1105 Andrew                                 £100.00~
|L|120:42 1105 Andrew                                 £100.00~
|L|B1Drop Date : 11/09/2022~
|L|120:30 1105 Andrew                                 £100.00~
|L|B1Drop Date : 07/10/2022~
|L|110:03 1105 Andrew                                 £100.00~
|L|B1Drop Date : 13/10/2022~
|L|122:47 1105 Andrew                                 £100.00~
|L|B1Drop Date : 17/10/2022~
|L|116:33 1105 Andrew                                 £100.00~
|L|B1Drop Date : 23/10/2022~
|L|121:44 1105 Andrew                                 £100.00~
|L|B1Drop Date : 26/10/2022~
|L|109:16 1105 Andrew                                 £100.00~
|L|B1Drop Date : 31/10/2022~
|L|119:32 1105 Andrew                                 £100.00~
|L|B1Drop Date : 01/11/2022~
|L|116:09 1105 Andrew                                 £100.00~
|L|B1Drop Date : 03/11/2022~
|L|122:21 1105 Andrew                                 £100.00~
|L|B1Drop Date : 05/11/2022~
|L|118:15 1105 Andrew                                 £100.00~
|L|B1Drop Date : 06/11/2022~
|L|117:37 1105 Andrew                                  £10.00~
|L|117:37 1105 Andrew                                  £10.00~
|L|B1Drop Date : 13/11/2022~
|L|119:26 1105 Andrew                                 £100.00~
|L|B1Drop Date : 28/11/2022~
|L|115:02 1105 Andrew                                 £100.00~
|L|B1Drop Date : 30/11/2022~
|L|113:29 1105 Andrew                                 £100.00~
|L|1--------------------------------------------------------~
|L|30 Drop(s)                                   Total £0.00~
|L|1--------------------------------------------------------~
|C|B1Wednesday 14 December 2022~
|C|B120:05  000445  1105  001  0000~
Post Reply