//private async void ImportVendorsAndCategories()
        //{
        //    Message msg = new Message();
        //    msg = handler.ObtainMessage();

        //    //msg.Arg1 = 0;
        //    //handler.SendMessage(msg);
        //    foxWebSvc.FoxSvcSql foxSql = new foxWebSvc.FoxSvcSql();
        //    vendors = foxSql.GetVendorList("192.168.100.97");

        //    //txtdbResult.Text += "Import complete.";
        //    //progBar.Hide();
        //    //return true;
        //    msg.Arg1 = 2;
        //    //msg.Arg2 = vendors;
        //    handler.SendMessage(msg);
        //}

        private async void ImportVendorsAndCategories2()
        {
            TextView       txtdbResult = FindViewById <TextView>(Resource.Id.txtdbResult);
            ProgressDialog progBar     = new ProgressDialog(this);

            progBar.SetCancelable(false);
            progBar.SetMessage("Getting data from server(7)...");
            progBar.SetProgressStyle(ProgressDialogStyle.Spinner);
            progBar.Show();

            var thread = new System.Threading.Thread(new ThreadStart(delegate
            {
                FoxScannerSvc.FoxScannerSvc foxSql = new FoxScannerSvc.FoxScannerSvc();
                vendors = foxSql.GetVendorList();
            }));

            thread.Start();

            while (thread.ThreadState == ThreadState.Running)
            {
                await Task.Delay(4000);
            }

            RunOnUiThread(() =>
            {
                txtdbResult.Text = "One moment please...";
            });

            progBar.Dismiss();
            VendorCatImportComplete();
        }
Exemple #2
0
        private void ImportStoreInfo()
        {
            FoxScannerSvc.FoxScannerSvc foxScannerSvc = new FoxScannerSvc.FoxScannerSvc();
            string storeData = foxScannerSvc.GetStoreInfoList();

            if (storeData != null)
            {
                if (storeData != "")
                {
                    if (db.ExecWriteSQLite(Constants.DBFilename, "delete from FoxStoreInfo", ref dbError))
                    {
                        string[] storeRecs = storeData.Split('|');
                        string   sql       = "";

                        for (int storeCT = 0; storeCT <= storeRecs.GetUpperBound(0); storeCT++)
                        {
                            if (storeRecs[storeCT] != "")
                            {
                                string[] storeRecord = storeRecs[storeCT].Split(',');

                                sql += "insert into FoxStoreInfo (StoreName, StoreCode, StoreServerIP) values ('" + storeRecord[0] + "','" + storeRecord[1] + "','" + storeRecord[2] + "'); ";
                            }
                        }

                        db.ExecWriteSQLiteBatch(Constants.DBFilename, sql, ref dbError);
                    }
                }
            }
        }
Exemple #3
0
        private string GetEmployeeNameFromNum(string empNum)
        {
            FoxScannerSvc.FoxScannerSvc foxSql = new FoxScannerSvc.FoxScannerSvc();
            string empName = foxSql.GetStoreEmployeeNameFromNum(empNum);

            return(empName);
        }
Exemple #4
0
        // ==================================================================

        private void DownloadVendorCatLists()
        {
            // ==============================================================
            // Use FoxScannerSvc to get string of vendor codes + names
            // ==============================================================

            Message msg = new Message();

            svcCallHandler = new EventandlerSvcCallComplete(this);
            msg            = svcCallHandler.ObtainMessage();

            ProgressDialog progBar = new ProgressDialog(this);

            progBar.SetCancelable(false);
            progBar.SetTitle("Synchronizing...");
            progBar.SetIcon(Resource.Drawable.iconChill64);
            progBar.SetMessage("Downloading vendor list from server");
            progBar.SetProgressStyle(ProgressDialogStyle.Spinner);
            progBar.Show();

            var thread = new System.Threading.Thread(new ThreadStart(delegate
            {
                try
                {
                    FoxScannerSvc.FoxScannerSvc foxSql = new FoxScannerSvc.FoxScannerSvc();
                    vendors = foxSql.GetVendorList();

                    RunOnUiThread(() =>
                    {
                        progBar.SetMessage("Downloading category list from server");
                    });

                    categories = foxSql.GetCategoryList();

                    RunOnUiThread(() =>
                    {
                        progBar.Dismiss();
                    });

                    msg.Arg1 = 0;
                    msg.Arg2 = 1;
                    svcCallHandler.SendMessage(msg);
                }
                catch (Exception ex)
                {
                    RunOnUiThread(() =>
                    {
                        progBar.Dismiss();
                    });

                    msg.Arg1 = 1;
                    msg.Arg2 = 1;
                    svcCallHandler.SendMessage(msg);
                }
            }));

            thread.Start();
        } // ImportVendorAndCategories()
        private void UpdateVerifiedEPCs(bool stealthMode)
        {
            Message msg = new Message();

            epcVerifyHandler = new EventHandlerUploadVerified(this);
            msg = epcVerifyHandler.ObtainMessage();

            // Display progress bar

            ProgressDialog progBar = new ProgressDialog(this);

            progBar.SetCancelable(false);
            progBar.SetMessage("Updating Verified Tickets...");
            progBar.SetProgressStyle(ProgressDialogStyle.Horizontal);
            progBar.Progress = 0;
            progBar.Max      = listFoxProducts.Count;
            progBar.Show();

            var thread = new System.Threading.Thread(new ThreadStart(delegate
            {
                string epcsVerified = "";

                for (int epcCT = 0; epcCT < listEPCsVerified.Count; epcCT++)
                {
                    if (epcCT > 0)
                    {
                        epcsVerified += ",";
                    }
                    epcsVerified += listEPCsVerified[epcCT];
                }

                FoxScannerSvc.FoxScannerSvc foxScannerSvc = new FoxScannerSvc.FoxScannerSvc();
                string result = foxScannerSvc.UpdateVerifiedEPCs(epcsVerified);

                if (result == "SUCCESS")
                {
                    if (!stealthMode)
                    {
                        listEPCsVerified.Clear();
                    }
                    msg.Arg1 = 0;
                }
                else
                {
                    msg.Arg1 = 1;
                }

                RunOnUiThread(() =>
                {
                    progBar.Dismiss();
                });

                epcVerifyHandler.SendMessage(msg);
            }));

            thread.Start();
        }
Exemple #6
0
        private void ImportRegistrationRecordFromWHS()
        {
            // * If FoxAdminRecord got wiped out somehow (most likely due to an update), try to restore the data from the S-WHS server
            if (serialNoTC20 != "")
            {
                Message msg = new Message();
                regHandler = new EventhandlerGetRegistration(this);
                msg        = regHandler.ObtainMessage();

                // Display progress bar

                ProgressDialog progBar = new ProgressDialog(this);

                progBar.SetCancelable(false);
                progBar.SetMessage("Retrieving scanner registration...");
                progBar.SetProgressStyle(ProgressDialogStyle.Spinner);
                progBar.Show();

                var thread = new System.Threading.Thread(new ThreadStart(delegate
                {
                    FoxScannerSvc.FoxScannerSvc foxScannerSvc = new FoxScannerSvc.FoxScannerSvc();
                    string getregistrationResult = foxScannerSvc.GetScannerRegistration(serialNoTC20);  // {ScannerID}, {StoreCode}

                    RunOnUiThread(() =>
                    {
                        progBar.Dismiss();
                    });

                    if (getregistrationResult != "")
                    {
                        string[] foxRegData = getregistrationResult.Split(',');
                        scannerID           = Convert.ToInt32(foxRegData[0]);
                        string storeCode    = foxRegData[1];

                        // Re-Write <FoxAdmin> record
                        db.ExecWriteSQLite(Constants.DBFilename, "delete from FoxAdminRecord", ref dbError);
                        if (db.ExecWriteSQLite(Constants.DBFilename, @"insert into FoxAdminRecord (ScannerID, StoreCode, AdminPW, LastVendorCatImport) 
                        values (" + scannerID.ToString() + ",'" + storeCode + "','Fox$RFID','1/1/2000')", ref dbError))
                        {
                            msg.Arg1 = 0;
                        }
                        else
                        {
                            msg.Arg1 = 1;
                        }
                    }
                    else
                    {
                        msg.Arg1 = 1;
                    }

                    regHandler.SendMessage(msg);
                }));

                thread.Start();
            } // if (serialTC20 != "")
        }     // Import()
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here

            SetContentView(Resource.Layout.layout_scannersetup);

            TextView txtAppVersion           = FindViewById <TextView>(Resource.Id.txtSettings_AppVersion);
            TextView txtScannerID            = FindViewById <TextView>(Resource.Id.txtSettings_ScannerNum);
            TextView txtWiFi                 = FindViewById <TextView>(Resource.Id.txtSettings_WiFiStatus);
            TextView txtDateTime             = FindViewById <TextView>(Resource.Id.txtSettings_DateTime);
            TextView txtFoxScanSvcAppVersion = FindViewById <TextView>(Resource.Id.txtSettings_ServiceVersion);
            TextView txtSerialTC20           = FindViewById <TextView>(Resource.Id.txtSettings_SerialTC20);
            TextView txtSerialRFD2000        = FindViewById <TextView>(Resource.Id.txtSettings_SerialRFD2000);
            Spinner  spnStores               = FindViewById <Spinner>(Resource.Id.spinnerSettingsStore);
            Button   btnRegister             = FindViewById <Button>(Resource.Id.btnSettings_Register);
            Button   btnExitSave             = FindViewById <Button>(Resource.Id.btnSettings_Exit);

            serialNoRFD2000 = Intent.GetStringExtra("serialRFD2000");

            scannerID = mcTools.GetScannerID();

            if (scannerID > 0)
            {
                txtScannerID.SetTextColor(Android.Graphics.Color.Black);
                txtScannerID.Text = scannerID.ToString();
            }
            else
            {
                txtScannerID.SetTextColor(Android.Graphics.Color.ParseColor("#F75555"));
                txtScannerID.Text = "Not Assigned";
            }

            txtSerialTC20.Text = serialNoTC20;
            if (serialNoRFD2000 == "")
            {
                txtSerialRFD2000.Text = "--------------";
            }
            else
            {
                txtSerialRFD2000.Text = serialNoRFD2000;
            }

            txtAppVersion.Text = "(app version 1." + Constants.CurrentVersion + ")";
            txtDateTime.Text   = DateTime.Now.ToLongDateString() + "  " + DateTime.Now.ToShortTimeString();

            NetworkStatusMonitor nm = new NetworkStatusMonitor();

            nm.UpdateNetworkStatus();

            int position = LoadStoreList();  // Load all stores from FoxStoreInfo table into spinner

            if (position > 0)
            {
                spnStores.SetSelection(position);
            }

            if (nm.State == NetworkState.ConnectedWifi)
            {
                wifiConnected = true;
                txtWiFi.SetTextColor(Android.Graphics.Color.Green);
                txtWiFi.Text = "Connected";

                // Display FoxScannerSvc version #

                FoxScannerSvc.FoxScannerSvc foxSql = new FoxScannerSvc.FoxScannerSvc();
                txtFoxScanSvcAppVersion.SetTextColor(Android.Graphics.Color.Black);

                try
                {
                    txtFoxScanSvcAppVersion.Text = "1." + foxSql.GetFoxScanSvcVersion();
                    foxSvcConnected = true;
                }
                catch (Exception exSvc)
                {
                    foxSvcConnected = false;
                }
            }
            else
            {
                wifiConnected = false;
                txtWiFi.SetTextColor(Android.Graphics.Color.ParseColor("#F75555"));
                txtWiFi.Text = "Not Connected!";

                txtFoxScanSvcAppVersion.SetTextColor(Android.Graphics.Color.ParseColor("#F75555"));
                txtFoxScanSvcAppVersion.Text = "???";
            }

            btnRegister.Click += BtnRegister_Click;
            btnExitSave.Click += BtnExitSave_Click;
        }
        private void BtnRegister_Click(object sender, EventArgs e)
        {
            Spinner spnStores = FindViewById <Spinner>(Resource.Id.spinnerSettingsStore);

            storeName = spnStores.SelectedItem.ToString();
            storeCode = mcTools.GetStoreCodeFromStoreName(storeName);

            if (wifiConnected)
            {
                if ((serialNoTC20 != "") && (serialNoRFD2000 != ""))
                {
                    Message msg = new Message();
                    regHandler = new EventandlerRegistration(this);
                    msg        = regHandler.ObtainMessage();

                    // Display progress bar

                    ProgressDialog progBar = new ProgressDialog(this);

                    progBar.SetCancelable(false);
                    progBar.SetMessage("Attempting scanner registration...");
                    progBar.SetProgressStyle(ProgressDialogStyle.Spinner);
                    progBar.Show();

                    var thread = new System.Threading.Thread(new ThreadStart(delegate
                    {
                        FoxScannerSvc.FoxScannerSvc foxScannerSvc = new FoxScannerSvc.FoxScannerSvc();
                        string registrationResult = foxScannerSvc.RegisterScanner(serialNoTC20, serialNoRFD2000, storeCode);  // {#} / EXISTS / ERROR

                        RunOnUiThread(() =>
                        {
                            progBar.Dismiss();
                        });

                        if ((registrationResult == "ERROR") || (registrationResult == ""))
                        {
                            msg.Arg1 = 2;
                        }
                        else
                        {
                            if (registrationResult == "EXISTS")
                            {
                                msg.Arg1 = 1;
                            }
                            else
                            {
                                if (mcTools.IsNumeric(registrationResult))
                                {
                                    scannerID = Convert.ToInt16(registrationResult);
                                    msg.Arg1  = 0;
                                }
                            }
                        }

                        regHandler.SendMessage(msg);
                    }));

                    thread.Start();
                }
                else
                {
                    string alertMsg = "";

                    if (serialNoTC20 == "")
                    {
                        alertMsg = "Unable to obtain TC20 serial #. Registration cannot be performed.";
                    }
                    else
                    {
                        if (serialNoRFD2000 == "")
                        {
                            alertMsg = "RFID scanner not detected. Unit may be in 'sleep mode'. Exit app, squeeze gun handle for 5 seconds to wakeup unit and try again.";
                        }
                    }

                    var builder = new AlertDialog.Builder(this);
                    dbError = "";
                    builder.SetMessage(alertMsg);
                    builder.SetTitle("Device error");
                    builder.SetIcon(Resource.Drawable.iconWarning64);
                    builder.SetPositiveButton("OK", (s, e2) =>
                    { /* Handle 'OK' click */
                    }
                                              );
                    builder.Create().Show();
                }
            }
            else
            {
                // WiFi not connected

                var builder = new AlertDialog.Builder(this);
                dbError = "";
                builder.SetMessage("WiFi not connected. Cannot proceed.");
                builder.SetTitle("Check WiFi connection");
                builder.SetIcon(Resource.Drawable.iconWarning64);
                builder.SetPositiveButton("OK", (s, e2) =>
                { /* Handle 'OK' click */
                }
                                          );
                builder.Create().Show();
            }
        }
        public void ScanResult(Intent intent)
        {
            //  Output the scanned barcode on the screen.  Bear in mind older JB devices will use the legacy DW parameters on unbranded devices.
            String decodedSource = intent.GetStringExtra(Resources.GetString(
                                                             Resource.String.datawedge_intent_key_source));
            String barCode = intent.GetStringExtra(Resources.GetString(
                                                       Resource.String.datawedge_intent_key_data));
            String decodedLabelType = intent.GetStringExtra(Resources.GetString(
                                                                Resource.String.datawedge_intent_key_label_type));

            //TextView scanSourceTxt = FindViewById<TextView> (Resource.Id.txtScanScource);
            //TextView scanDataTxt = FindViewById<TextView> (Resource.Id.txtScanData);
            //TextView scanLabelTypeTxt = FindViewById<TextView> (Resource.Id.txtScanDecoder);
            //scanSourceTxt.Text = "Scan Source: " + decodedSource;
            //scanDataTxt.Text = "Scan Data: " + decodedData;
            //scanLabelTypeTxt.Text = "Scan Decoder: " + decodedLabelType;


            if (storeCode != "")
            {
                TextView txtBarcode = FindViewById <TextView>(Resource.Id.txtBarcode);
                barCode         = BarcodeStrip9(barCode);
                txtBarcode.Text = barCode;

                if (BarcodeValid(barCode))
                {
                    ///////////////////////////////////
                    // Pull Last Sold / Consol Data
                    ///////////////////////////////////

                    NetworkStatusMonitor nm = new NetworkStatusMonitor();
                    nm.UpdateNetworkStatus();

                    dataLastSoldResult = "";
                    dataMDResult       = "";
                    InitResultFields();

                    if (nm.State == NetworkState.ConnectedWifi)
                    {
                        Message msg = new Message();
                        dataHandler = new DataRetrievalHandler(this);
                        msg         = dataHandler.ObtainMessage();

                        // Display progress bar

                        ProgressDialog progBar = new ProgressDialog(this);

                        progBar.SetCancelable(false);
                        progBar.SetTitle("Retrieving data");
                        progBar.SetIcon(Resource.Drawable.iconChill64);
                        progBar.SetMessage("One moment please...");
                        progBar.SetProgressStyle(ProgressDialogStyle.Spinner);
                        progBar.Show();

                        var thread = new System.Threading.Thread(new ThreadStart(delegate
                        {
                            try
                            {
                                FoxScannerSvc.FoxScannerSvc foxScannerSvc = new FoxScannerSvc.FoxScannerSvc();
                                dataLastSoldResult = foxScannerSvc.GetLastSoldInfo(barCode);
                                dataMDResult       = foxScannerSvc.GetMarkdownsVendor(barCode.Substring(0, 3), storeCode);

                                RunOnUiThread(() =>
                                {
                                    progBar.Dismiss();
                                });
                                msg.Arg1 = 0;
                                dataHandler.SendMessage(msg);
                            }
                            catch (Exception ex)
                            {
                                RunOnUiThread(() =>
                                {
                                    progBar.Dismiss();
                                });
                                msg.Arg1 = 1;
                                dataHandler.SendMessage(msg);
                            }
                        }));

                        thread.Start();
                    }
                    else
                    {
                        var builder = new Android.App.AlertDialog.Builder(this);
                        builder.SetTitle("WiFi NOT Connected!!");
                        builder.SetIcon(Resource.Drawable.iconWarning64);
                        builder.SetMessage("WiFi is not connected. Please connect WiFi and try again.");
                        builder.SetPositiveButton("OK", (s, e2) =>
                        {
                            // Goto transfer data w/ nextActivity = "SCANOPTIONS"
                        }
                                                  );
                        builder.Create().Show();
                    }
                }
                else
                {
                    var builder = new Android.App.AlertDialog.Builder(this);
                    builder.SetTitle("Invalid Barcode!!");
                    builder.SetIcon(Resource.Drawable.iconWarning64);
                    builder.SetMessage("The barcode scanned is not recognized as a valid Fox's barcode.");
                    builder.SetPositiveButton("OK", (s, e2) =>
                    {
                        // Goto transfer data w/ nextActivity = "SCANOPTIONS"
                    }
                                              );
                    builder.Create().Show();
                }
            }
            else
            {
                var builder = new Android.App.AlertDialog.Builder(this);
                builder.SetTitle("Scanner NOT Registered!");
                builder.SetIcon(Resource.Drawable.iconWarning64);
                builder.SetMessage("The scanner must be registered before this utility can be used.");
                builder.SetPositiveButton("OK", (s, e2) =>
                {
                    // Goto transfer data w/ nextActivity = "SCANOPTIONS"
                }
                                          );
                builder.Create().Show();
            }
        }
Exemple #10
0
        private void BtnTransfer_Click(object sender, EventArgs e)
        {
            Button btnTransfer = FindViewById <Button>(Resource.Id.btnxFerData);

            btnTransfer.Enabled = false;

            // Check WiFi status first

            NetworkStatusMonitor nm = new NetworkStatusMonitor();

            nm.UpdateNetworkStatus();

            if (nm.State == NetworkState.ConnectedWifi)
            {
                // Transfer Data

                Message msg = new Message();
                xFerHandler = new xFerEventHandler(this);
                msg         = xFerHandler.ObtainMessage();

                // Display progress bar

                ProgressDialog progBar = new ProgressDialog(this);

                progBar.SetCancelable(false);
                progBar.SetTitle("Transferring Data");
                progBar.SetIcon(Resource.Drawable.iconChill64);
                progBar.SetMessage("One moment please...");
                progBar.SetProgressStyle(ProgressDialogStyle.Spinner);
                progBar.Show();

                var thread = new System.Threading.Thread(new ThreadStart(delegate
                {
                    int scannerID = mcTools.GetScannerID();

                    // Create data list

                    List <FoxProduct> foxProducts = db.ExecQuery_FoxProduct(Constants.DBFilename, "select * from FoxProduct order by FoxSKU, epcLast6", ref dbError);

                    if (foxProducts == null)
                    {
                        resultxFer = "Failed to create foxProducts export list. Failed to read table.";
                        msg.Arg1   = 1;
                    }
                    else
                    {
                        if (foxProducts.Count > 0)
                        {
                            // Create data string to send

                            RunOnUiThread(() =>
                            {
                                progBar.SetTitle("Transferring Data...");
                                progBar.SetIcon(Resource.Drawable.iconChill64);
                                progBar.SetProgressStyle(ProgressDialogStyle.Horizontal);
                                progBar.Progress = 0;
                                progBar.Max      = foxProducts.Count;
                                progBar.SetMessage("Exporting inventory records...");
                            });

                            string scannerData = "";

                            for (int recordCT = 0; recordCT < foxProducts.Count; recordCT++)
                            {
                                // Data to be transferred in format {EmpNo},{EPC},{Qty},{ActionWOtherLoc},{NewConsol},{OtherStoreCode},{DateTimeScanned}|
                                scannerData += foxProducts[recordCT].EmployeeID + ",";
                                scannerData += foxProducts[recordCT].EPC + ",";
                                scannerData += foxProducts[recordCT].Qty.ToString() + ",";
                                scannerData += foxProducts[recordCT].ActionWOtherLoc + ",";
                                scannerData += foxProducts[recordCT].NewConsol + ",";
                                scannerData += foxProducts[recordCT].OtherStoreCode + ",";
                                scannerData += foxProducts[recordCT].DateTimeScanned;

                                if (recordCT < (foxProducts.Count - 1))
                                {
                                    scannerData += "|";
                                }

                                RunOnUiThread(() =>
                                {
                                    progBar.Progress = recordCT;
                                });
                            }

                            RunOnUiThread(() =>
                            {
                                progBar.SetProgressStyle(ProgressDialogStyle.Spinner);
                                progBar.SetMessage("Just a few more seconds...");
                            });

                            FoxScannerSvc.FoxScannerSvc foxScannerSvc = new FoxScannerSvc.FoxScannerSvc();
                            resultxFer = foxScannerSvc.UploadRFIDInvScans(scannerID.ToString(), scannerData, foxProducts.Count);

                            if (resultxFer != "")
                            {
                                string[] resultValues = resultxFer.Split('|');

                                if (resultValues[0] == "[SUCCESS]")
                                {
                                    string batchNo       = resultValues[1];
                                    int unitsTransferred = foxProducts.Count;

                                    int unitsIN  = Convert.ToInt32(db.ExecQuery_Scalar(Constants.DBFilename, "select count(Qty) from FoxProduct where Qty > 0", ref dbError));
                                    int unitsOUT = Convert.ToInt32(db.ExecQuery_Scalar(Constants.DBFilename, "select count(Qty) from FoxProduct where Qty < 0", ref dbError));
                                    int unitsOH  = Convert.ToInt32(db.ExecQuery_Scalar(Constants.DBFilename, "select count(Qty) from FoxProduct where Qty = 0", ref dbError));

                                    // ====================================
                                    // Write batch Info to <xferLog>
                                    // ====================================

                                    string sqlBatch = "";

                                    if (unitsIN > 0)
                                    {
                                        string empNo = db.ExecQuery_Scalar(Constants.DBFilename, "select EmployeeID from FoxProduct where Qty > 0 limit 1", ref dbError);

                                        sqlBatch += @"insert into XFerLog (BatchNo, Units, InvType, EmpNo, TransferDate) values
                                        ('" + batchNo + "'," + unitsIN.ToString() + ",'IN','" + empNo + "','" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + "');";
                                    }

                                    if (unitsOUT > 0)
                                    {
                                        string empNo = db.ExecQuery_Scalar(Constants.DBFilename, "select EmployeeID from FoxProduct where Qty < 0 limit 1", ref dbError);

                                        sqlBatch += @"insert into XFerLog (BatchNo, Units, InvType, EmpNo, TransferDate) values
                                        ('" + batchNo + "'," + unitsOUT.ToString() + ",'OUT','" + empNo + "','" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + "');";
                                    }

                                    if (unitsOH > 0)
                                    {
                                        string empNo = db.ExecQuery_Scalar(Constants.DBFilename, "select EmployeeID from FoxProduct where Qty = 0 limit 1", ref dbError);

                                        sqlBatch += @"insert into XFerLog (BatchNo, Units, InvType, EmpNo, TransferDate) values
                                        ('" + batchNo + "'," + unitsOH.ToString() + ",'OH','" + empNo + "','" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + "');";
                                    }

                                    db.ExecWriteSQLiteBatch(Constants.DBFilename, sqlBatch, ref dbError);

                                    // =======================================
                                    // Wipeout <FoxProduct>
                                    // =======================================

                                    if (db.ExecWriteSQLite(Constants.DBFilename, "delete from FoxProduct", ref dbError))
                                    {
                                        msg.Arg1 = 0;
                                    }
                                    else
                                    {
                                        // Notify user that data xferred, but needs to be deleted from scanner
                                    }
                                }
                                else
                                {
                                    msg.Arg1 = 1;
                                }
                            }
                            else
                            {
                                msg.Arg1 = 1;
                            }
                        }
                        else
                        {
                            msg.Arg1 = 0;
                        }
                    }

                    RunOnUiThread(() =>
                    {
                        progBar.Dismiss();
                    });

                    xFerHandler.SendMessage(msg);
                }));

                thread.Start();
            }
            else
            {
                var builder = new Android.App.AlertDialog.Builder(this);
                builder.SetTitle("WiFi NOT Connected!!");
                builder.SetIcon(Resource.Drawable.iconWarning64);
                builder.SetMessage("WiFi is not connected. Please connect WiFi and try again.");
                builder.SetPositiveButton("OK", (s, e2) =>
                {
                    // Goto transfer data w/ nextActivity = "SCANOPTIONS"
                }
                                          );
                builder.Create().Show();
            }
        } // Transfer_Click()
        private void LoadVerifyTickets(string batchList)
        {
            InitEPCArray();
            listFoxProducts.Clear();
            listEPCsVerified.Clear();

            Message msg = new Message();

            epcLoadHandler = new EventHandlerEPCVerifyLoadComplete(this);
            msg            = epcLoadHandler.ObtainMessage();

            ProgressDialog progBar = new ProgressDialog(this);

            progBar.SetCancelable(false);
            progBar.SetTitle("Retrieving Ticket Data...");
            progBar.SetIcon(Resource.Drawable.iconChill64);
            progBar.SetMessage("Importing Ticket Info...");
            progBar.SetProgressStyle(ProgressDialogStyle.Spinner);
            progBar.Progress = 0;
            progBar.Show();

            var thread = new System.Threading.Thread(new ThreadStart(delegate
            {
                try
                {
                    FoxScannerSvc.FoxScannerSvc foxSql = new FoxScannerSvc.FoxScannerSvc();
                    string epcList = foxSql.GetRFIDEPCsfromBatchList(batchList);

                    if (epcList != "")
                    {
                        string[] epcArray = epcList.Split(',');

                        for (int i = 0; i <= epcArray.GetUpperBound(0); i++)
                        {
                            if (epcArray[i] != "")
                            {
                                //AddEPC(epcArray[i]);

                                FoxProduct prod = new FoxProduct();
                                prod.EPC        = epcArray[i];
                                prod.FoxSKU     = mcTools.GetFoxSKUFromEPC(prod.EPC);
                                prod.VendorCode = prod.FoxSKU.Substring(0, 3);
                                prod.Category   = prod.FoxSKU.Substring(3, 2);
                                prod.epcLast6   = Convert.ToInt16(epcArray[i].Substring(26, 6));
                                prod.Qty        = 1; // 1 = IN, -1 = OUT, 0 = CURRENT ON HAND

                                listFoxProducts.Add(prod);

                                // Below does not pertain to inv tix verification

                                //prod.ActionWOtherLoc = toFrom;
                                //prod.NewConsol = newConsol;
                                //prod.OtherStoreCode = destStoreCode;
                                //prod.DateTimeScanned = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString();
                                //prod.EmployeeID = empNo;
                            }
                        }
                    }

                    RunOnUiThread(() =>
                    {
                        progBar.Dismiss();
                    });

                    msg.Arg1 = 0;
                    epcLoadHandler.SendMessage(msg);
                }
                catch (Exception ex)
                {
                    msg.Arg1 = 1;
                    epcLoadHandler.SendMessage(msg);
                }
            }));

            thread.Start();
        } // LoadVerifyTickets()
Exemple #12
0
        private void LoadRecentInvTixBatches()
        {
            // Perform service call to retrieve batch list

            Message msg = new Message();

            svcCallHandler = new EventandlerBatchListComplete(this);
            msg            = svcCallHandler.ObtainMessage();

            ProgressDialog progBar = new ProgressDialog(this);

            progBar.SetCancelable(false);
            progBar.SetTitle("Retrieving Batches...");
            progBar.SetIcon(Resource.Drawable.iconChill64);
            progBar.SetMessage("Importing batch list...");
            progBar.SetProgressStyle(ProgressDialogStyle.Spinner);
            progBar.Progress = 0;
            progBar.Show();

            var thread = new System.Threading.Thread(new ThreadStart(delegate
            {
                try
                {
                    FoxScannerSvc.FoxScannerSvc foxSql = new FoxScannerSvc.FoxScannerSvc();
                    string batchData = foxSql.GetRecentInvTixBatches();

                    if (batchData == "ERROR")
                    {
                        msg.Arg1 = 1;  // error occurred
                        svcCallHandler.SendMessage(msg);
                    }
                    else
                    {
                        if (batchData != "")
                        {
                            // Load batch data into List<InvTixBatch>

                            string[] batchRecords = batchData.Split('|');
                            int brCT = 0;

                            while (brCT <= batchRecords.GetUpperBound(0))
                            {
                                if (batchRecords[brCT].Trim() != "")
                                {
                                    string[] batchDetail = batchRecords[brCT].Split(',');

                                    InvTixBatch batchRec = new InvTixBatch();

                                    batchRec.BatchNo    = Convert.ToInt32(batchDetail[0]);
                                    batchRec.VendorCode = batchDetail[1];
                                    batchRec.Qty        = Convert.ToInt32(batchDetail[2]);
                                    batchRec.BatchTime  = Convert.ToDateTime(batchDetail[3]);

                                    listBatchDetail.Add(batchRec);
                                }
                                brCT++;
                            }
                        }

                        RunOnUiThread(() =>
                        {
                            progBar.Dismiss();
                        });

                        msg.Arg1 = 0;
                        svcCallHandler.SendMessage(msg);
                    }
                }
                catch (Exception ex)
                {
                    RunOnUiThread(() =>
                    {
                        progBar.Dismiss();
                    });

                    msg.Arg1 = 1;  // error occurred
                    svcCallHandler.SendMessage(msg);
                }
            }));

            thread.Start();
        }  // LoadRecentInvTixBatches()