0

I currently have a c# process detailed below

  1. User places item on scale (sees weight through UI)
  2. User clicks print on UI.
  3. Webservice is called. 3a. Webservice inserts into db (transaction). 3b. Connects to zebra printer checks the printer status and sends zpl data string. 3c. Closes the connection to the printer. 3d. Persist to DB if no errors and returns from Webservice call.

The issues is that this is a face paced environment and this process needs to take less than a few seconds (which it was doing). Also there are times were the connection to printer fails.

I am thinking of changing the code so that the UI opens a connection to the printer when the application is run (in the morning) and change the process such that:

  1. User starts application and a connection to the printer is established. (TCP/IP) 2 User places item on scale (sees weight through UI)
  2. User clicks print on UI.
  3. UI uses connection in step one and prints. If print is successful.
  4. Webservice is called. 3a. Webservice inserts into db (transaction).
  5. At end of shift close the connection to the printer and clean up.

Note the printer is only connected to this scale and not used by another process.

Delphi Coder
  • 1,723
  • 1
  • 14
  • 25
Mohamed
  • 567
  • 1
  • 9
  • 21
  • Creating a new connection to a printer over ether net will take milliseconds. Likely faster than the reaction time of any user. I actually dont see any issue either way, or what problem you are trying to solve. In fact the internal processing of the ZPL is likely going to be the slowest part of all the things you mentioned anyway – TheGeneral Nov 06 '20 at 01:56
  • The issue is that at random times I get a failed connection error. I believe that even though I am calling close everytime I open a connection either the connection is not closing or the printer is keeping connection alive. When that happens I turn off the printer and back on and it works. – Mohamed Nov 06 '20 at 02:00
  • Either you have an environmental issue, a hardware issue with the printer, or software issue. In most of those cases, you will get the same issue anyway – TheGeneral Nov 06 '20 at 02:01
  • I cant see how a static connection is going to help really. Though it may work for you – TheGeneral Nov 06 '20 at 02:07
  • Its seems like it's not a software issue as nothing changed since last time this was working fine. I was thinking a "static" connection would stay alive and thus not create multiple connections to the printer – Mohamed Nov 06 '20 at 03:00

1 Answers1

0

You could connect the zebra printer to the computer running your application with USB instead of Ethernet.

.NET code to send ZPL to Zebra printers

I have used this code and there is no noticeable delay in printing.