public string downfile = "\ \ download. txt";//download path public string LoadFile = "\ \ Upload. txt";//upload path public list<string& Gt _readtxt = new list<string> (); Public MainForm () {InitializeComponent (); Tbdelivery.focus (); private void Btndownload_click (object sender, EventArgs e) {try {if (TbDelivery.Text.Trim (). Length = = 0) {MES. Pda. Core.Service.MessageServices.ShowWarm ("Please scan the supply number first!") "); Tbdelivery.focus (); Return } else {if (! Checkdelivery ()) {return; } if (System.IO.File.Exists (Downfile)) {StreamReader Objread ER = new StreamReader (downfile); String sline = ""; sline = Objreader.readliNE (); if (sline! = string. Empty) {string[] ss = Sline.split (', '); if (ss. Length > 0) {if (ss[0]! = TbDelivery.Text.Trim ()) {MES. Pda. Core.Service.MessageServices.ShowWarm ("This machine has been downloaded supply number:" + ss[0] + ", please scan the supply number and upload. Download the other supply numbers again!"); Objreader.close (); Return } else {MES. Pda. Core.Service.MessageServices.ShowWarm ("The supply number has been downloaded, please scan and upload!")
"); Objreader.close (); Return }}} objreader.close (); } else {FileStream fs = System.IO.File.Create (Downfile); StreamWriter SW = new StreamWriter (FS, System.Text.Encoding.GetEncoding ("UTF-8")); String sql = Sql.getdelivery (TbDelivery.Text.Trim ()); Daisy.Common.McsClient.McsDataReader reader = (Daisy.Common.McsClient.McsDataReader) MES. Pda. Core.Service.DatabaseAccessService.execute (SQL, MES. Pda. Core.Service.ReturnType.RESULTSET); if (Reader.rownumber = = 0) {MES. Pda. Core.Service.MessageServices.ShowWarm ("Get Supply number information failed!") "); Sw. Close (); Return } else {String sline = string. Empty; while (reader. Read ()) {//mes. Pda. Core.Service.MessageServices.ShowWarm (reader.getstring (2)); sline = reader.getstring (0) + "," + reader.getstring (1) + "," + reader.getstring (2) + "," + reader.getstring (3) + "," + RE Ader.getstring (4) + "," + reader.getstring (5); Sw. WriteLine (sline); Sw. WriteLine (sline); } SW. Flush (); Sw. Close (); } var sqlload = "{? =call apps.cux_pda_load_scan_utl.init_data_download ('" + TbDelivery.Text.Trim () + "')}"; Mes. Pda. Core.Service.MessageServices.ShowWarm (SQL); Return string ret = (string) MES. Pda. Core.Service.DatabaseAccessService.execute (Sqlload, returntype.string); if (!ret. StartsWith ("[email protected]")) {MES. Pda. Core.Service.MessageServices.ShowWarm (ret); Return } else {MES. Pda. Core.Service.MessageServices.ShowWarm ("Download successful!
"); Btnscan.focus (); }}}} catch (Exception ex) {MES. Pda. Core.Service.MessageServices.ShowWarm (ex. ToString ()); } }
PDA development data downloaded from DB to PDA local