Pregunta

I am working with a page in WebMatrix that takes data entry from a tech on a manufacturing line, and inserts 3 nearly identical records to a database. I need to, after each of the 3 record inserts, generate 9 barcode stickers. The barcode printing from a vbhtml page is working fine too.

This is my post code from the form that inserts all the records.

If IsPost And Validation.IsValid Then
    If ModelState.IsValid Then

        Dim a = 0
        Dim blockNumber, blockSection As String
        Dim i = Request("dropdownSection")

        Do While a < i
            Select Case a
                Case = 0 'this would be the A section
                blockNumber = Helpers.GetBlockNumber("1", Request("textWorkorder"),
                                                    Request("dropdownSheeter"), Request("dropdownMaterial"))


                blockSection = "A"
                db.Execute(strQuery, Request("textDate"), Request("dropdownSheeter"), Request("dropdownShift"), Request("dropdownEmployees"),
                                        Request("textWorkorder"), blockNumber, blockSection,
                                        Request("textComments"), Request("textFoilNum1"), Request("textFoilNum2"), 
                                        Request("textFoilNum3"), Request("dropdownPrintLine"), Request("dropdownMaterial"))


                Case = 1 'this would be the B section
                blockNumber = Helpers.GetBlockNumber("2", Request("textWorkorder"),
                                                    Request("dropdownSheeter"), Request("dropdownMaterial"))

                blockSection = "B"
                db.Execute(strQuery, Request("textDate"), Request("dropdownSheeter"), Request("dropdownShift"), Request("dropdownEmployees"),
                                        Request("textWorkorder"), blockNumber, blockSection,
                                        Request("textComments"), Request("textFoilNum1"), Request("textFoilNum2"), 
                                        Request("textFoilNum3"), Request("dropdownPrintLine"), Request("dropdownMaterial"))

                Case = 2 'this would be the C section
                blockNumber = Helpers.GetBlockNumber("3", Request("textWorkorder"),
                                                    Request("dropdownSheeter"), Request("dropdownMaterial"))

                blockSection = "C"
                db.Execute(strQuery, Request("textDate"), Request("dropdownSheeter"), Request("dropdownShift"), Request("dropdownEmployees"),
                                        Request("textWorkorder"), blockNumber, blockSection,
                                        Request("textComments"), Request("textFoilNum1"), Request("textFoilNum2"), 
                                        Request("textFoilNum3"), Request("dropdownPrintLine"), Request("dropdownMaterial"))
            End Select
        a = a + 1
        Loop

    End If

What I am trying to figure out is after each insert in the case statement, I need to call a jquery function that generates 3 of the 9 reports for each case.

function OpenReports(block)
{
    var wo = $('#textWorkorder').val()

    var url = '/Reports/NomexBlockLabel.vbhtml?id=' + wo + '&block=' + block
    window.open(url, '_blank');

};

How can I call that OpenReports function from inside each case statement? Is that possible? Should I try and use VB to open the URLS to the reports?

Thanks! Ryan

¿Fue útil?

Solución

It sounds like SignalR would be the ideal answer here. SignalR would allow you to call client-side functions after each case statement on the server side. SignalR has a nuget package which makes it fairly easy to implement. You can learn more here: http://signalr.net/

Alternatively, can you just concatenate all the stickers into one output after all the case statements are finished? I'm not sure if you have to call the NomexBlockLagel.vbhtml page separately for each case statement or if you could reuse the code from that page in the loop to combine the outputs.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top