Reprinted barcode printing by producing manufacturing traceability system

In the previous blog, I introduced how to achieve barcode printing on the production site, and our life is a bar code, one-dimensional code, and the QR code can be seen everywhere. Not to mention a factory engaged in the production and manufacturing and processing, there are many kinds of barcodes, offline printing, etc., directly lead to difficulty in barcode control, and even more serious quality events, the last version I passed the web application The program calls the function in WinForm for printing. WebBrowser is nestled in WinForm to browse the web. This method is basically able to meet most of the needs, but it is still in the United States, but also the browser kernel as used by WebBrowser Low, causing a lot of styles that cannot be compatible, although there are some methods on the network to change this problem (such as webkit, cef, modifying registry, etc.), but there is always more or less problems.

New solution, say goodbye to Winform & WebBrowser

We used the production line cartoon packaging station as an example, and described:

Usually, the operator will scan more A color box bar code, the number of this scan is not equal, there is a unique bar code or two-dimensional code above each color box. When the color box scan is completed, the box will be completed, and the system should directly correspond to it. The cartoon label is printed, the operator tears the cartoon label and puts on the cartoon box, before this, we need to make the cartoon label print template and upload it to the system, the operation interface is as follows, support the same One product prints multiple labels:

At this point, we need to write an API to get the template file above the server and the list of data that needs to be printed, the key code is as follows: 生产制造追溯系统之再说条码打印

String serverURL = XMLHELPER.GETXMLREADER (Path, “Config”, “Server”); string API = XMLHELPER.GETXMLREADER (PATH, “config”, “API”); // Get template files via API ******************************************* *********************************** STRING _BTW_URL = API + “? action = get_carton_label & carton_sn =” + _carton_sn; HttpHelper http_btw = new HttpHelper (); // Create Httphelper parameter object HttpItem item_btw = new HttpItem () {URL = _Btw_Url, // URL required items ContentType = “application / json”,}; HttpResult req_result_btw = http_btw.GetHtml (item_btw) ; string btw_str = req_result_btw.Html; JObject obj_btw = (JObject) JsonConvert.DeserializeObject (btw_str); DataTable dt = Library.JsonLib.ToDataTable (obj_btw [ “msg”] ToString ().); // get through the API template file * *********************************************************** ****************

   WebClient Web = New WebClient (); string _API_URL = API + "? Action =get_carton_print_list & carton_sn = "+ _carton_sn; HttpHelper http_data_list = new HttpHelper (); // Create Httphelper parameter object HttpItem item_data_list = new HttpItem () {URL = _Api_Url, // URL required items ContentType =" application / json ",}; HttpResult req_result_data_list = http_data_list.GetHtml (item_data_list); string print_str = req_result_data_list.Html; JObject obj = (JObject) JsonConvert.DeserializeObject (print_str); string _Key = obj [ "msg"] [ "key"] ToString ();. string _Value = obj ["msg"] ["value"]. TOSTRING (); string splitkey = "*"; string [] keys = _key.split (splitkey.tochararray (), stringsplitoptions.none; string [] value = _value.split, String [] VALUES = _Value.split (splitkey.tochararray (), stringsplitoptions.none; for (int i = 0; i 
After the API is written, we will release it to local specified a folder Live for spare, now we are still a stepHow is it how to print in the client through the web? Everyone knows our website is deploying on the server instead of the client, but the printed bar code must appear on the client’s local printer, you can consider the way to share the printer is achieved, but this method is very Stable, some security settings are enough to allow you to make your internal face, so we can consider using Cassinidev to implement, the rough ideas are as follows:
  Creating a batch or other type of program. < dt.Rows.Count; i++)
  _file_url = ServerUrl + "app/cartonlabel/" + dt.Rows[i]["LABEL_FILE"].ToString();
  _file_name = System.Guid.NewGuid().ToString() + "_" + dt.Rows[i]["LABEL_FILE"].ToString();
  web.DownloadFile(_file_url, _directory + _file_name);
Reference Cassinidev files in the project.
A service instance in the local NEW is started.

  • New Server (9001, “/”, Appdomain.currentDomain.basedirectory, “service”), System.Net.Ipaddress.Parse (“”), “”, 0, false, false);

Before packaging, we started the service, I made a simple interface, as shown below:
 At this time, we need to use the previous release API, copy the released API file to the service directory, this service directory under the root directory of this batch program, all the previous work has been done, now just call the local API. We chose the MO-00002 working order for demonstration:   

Next, the scan bar code is packed The package capacity of the product requires 4 color boxes for each cartoon box.

生产制造追溯系统之再说条码打印 [1

When the system prompts the command to send success, our printer has automatically printed the label, as shown below: 生产制造追溯系统之再说条码打印


生产制造追溯系统之再说条码打印 Relative to WebBrowser, this method can be better compatible with style sheets, such as H5, and then the same system is not Divided into the webpage and the client, although the same website is opened; it is more convenient to maintain it.

The above is the production manufacturing trace system introduced by Xiaobian, and I hope that everyone will help everyone. If you have any questions, please leave a message, the small package will reply to everyone. Thank you very much for your support of Tumi Cloud Website!

© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment