Beispiel #1
0
 private void ClaimPosCommon()
 {
     try
     {
         if (_posCommonScanner != null)
         {
             _posCommonScanner.Claim(iTimeOut);
             _posCommonScanner.DeviceEnabled = true;
         }
         if (_posCommonScale != null)
         {
             _posCommonScale.Claim(iTimeOut);
             ((Scale)_posCommonScale).StatusNotify = StatusNotify.Enabled;
             _posCommonScale.DeviceEnabled         = true;
         }
         if (_CashDrawer != null)
         {
             _CashDrawer.Claim(iTimeOut);
         }
         if (_PosPrinter != null)
         {
             _PosPrinter.Claim(iTimeOut);
         }
     }
     catch (Exception ex)
     {
         sMessengeError = ex.Message;
     }
 }
Beispiel #2
0
        private void openDrawer()
        {
            if (m_Drawer != null)
            {
                try
                {
                    //Open the device
                    //Use a Logical Device Name which has been set on the SetupPOS.
                    m_Drawer.Open();

                    //Get the exclusive control right for the opened device.
                    //Then the device is disable from other application.
                    m_Drawer.Claim(1000);

                    //Enable the device.
                    m_Drawer.DeviceEnabled = true;

                    //Open the drawer by using the "OpenDrawer" method.
                    m_Drawer.OpenDrawer();

                    m_Drawer.DeviceEnabled = false;
                    m_Drawer.Release();
                    m_Drawer.Close();
                }
                catch (Exception)
                {
                    useNativePrinter();
                }
            }
            else
            {
                useNativePrinter();
            }
        }
Beispiel #3
0
        private static void InitializeCashDrawer2()
        {
            DeviceCollection cashDrawerList = CashDrawerDeviceCollection;

            if (cashDrawerList.Count > 0)
            {
                try
                {
                    DeviceInfo cashDrawer = GetActiveDeviceInfo(cashDrawerList,
                                                                "CashDrawerName2", true);
                    if (cashDrawer != null)
                    {
                        activeCashDrawer2 = (CashDrawer)explorer.CreateInstance(cashDrawer);
                        activeCashDrawer2.Open();
                        activeCashDrawer2.Claim(1000);
                        activeCashDrawer2.DeviceEnabled = true;
                    }
                }
                catch (PosControlException)
                {
                    // Log error and set the active to nil
                    activeCashDrawer2 = null;
                    Logger.Error("InitializePosDevices", Strings.InitializationException);
                }
            }
        }
Beispiel #4
0
        public void OpenCashDrawer(bool IsWaited = false)
        {
            try
            {
                string strLogicalName = "CashDrawer";

                //PosExplorerを生成します。
                PosExplorer posExplorer = new PosExplorer();

                DeviceInfo deviceInfo = null;

                deviceInfo = posExplorer.GetDevice(DeviceType.CashDrawer, strLogicalName);
                m_Drawer   = (CashDrawer)posExplorer.CreateInstance(deviceInfo);
                try
                {
                    // m_Drawer.DeviceEnabled = true;
                }
                catch { }
                m_Drawer.Open();

                m_Drawer.Claim(1000);

                //デバイスを使用可能(動作できる状態)にします。

                m_Drawer.DeviceEnabled = true;
            }
            catch (PosControlException)
            {
            }
            m_Drawer.OpenDrawer();

            // ドロワーが開いている間、待ちます。

            while (m_Drawer.DrawerOpened == false)
            {
                System.Threading.Thread.Sleep(100);
            }

            //開いてから10秒間経っても閉じられない場合はビープ音を断続的に鳴らします。

            //このメソッドを実行すると、ドロワーが閉じられるまで処理が戻ってこないので注意してください。

            if (IsWaited)
            {
                m_Drawer.WaitForDrawerClose(10000, 2000, 100, 1000);
            }

            try
            {
                CloseCashDrawer();
            }
            catch
            {
                try
                {
                    m_Drawer = null;
                }
                catch { }
            }
        }
        public OPOSCashDrawerServer(string deviceName)
        {
            PosExplorer      myPosExplorer = new PosExplorer();
            DeviceCollection myDevices     = myPosExplorer.GetDevices(DeviceType.CashDrawer);

            try
            {
                foreach (DeviceInfo devInfo in myDevices)
                {
                    if (devInfo.ServiceObjectName == deviceName)
                    {
                        _cashDrawer = myPosExplorer.CreateInstance(devInfo) as CashDrawer;

                        //open
                        _cashDrawer.Open();

                        //claim the printer for use
                        _cashDrawer.Claim(CLAIM_TIMEOUT_MS);

                        //make sure it is enabled
                        _cashDrawer.DeviceEnabled = true;
                    }
                }

                if (_cashDrawer == null)
                {
                    throw new Exception("No Cash Drawer Available!");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("No Cash Drawer Available!");
            }
        }
Beispiel #6
0
 public void OpenCashDrawer()
 {
     myCashDrawer.Open();
     myCashDrawer.Claim(1000);
     myCashDrawer.DeviceEnabled = true;
     myCashDrawer.OpenDrawer();
     myCashDrawer.DeviceEnabled = false;
     myCashDrawer.Release();
     myCashDrawer.Close();
 }
 public void openCashDrawer2()
 {
     myCashDrawer.Open();
     myCashDrawer.Claim(1000);
     myCashDrawer.DeviceEnabled = true;
     myCashDrawer.OpenDrawer();
     myCashDrawer.DeviceEnabled = false;
     myCashDrawer.Release();
     myCashDrawer.Close();
     //myCashDrawer.CapStatus
 }
Beispiel #8
0
Datei: POS.cs Projekt: PCDCOM/RT
 public void OpenCashDrawer()
 {
     try
     {
         myCashDrawer.Open();
         myCashDrawer.Claim(1000);
         myCashDrawer.DeviceEnabled = true;
         myCashDrawer.OpenDrawer();
         myCashDrawer.DeviceEnabled = false;
         myCashDrawer.Release();
         myCashDrawer.Close();
     }
     catch (Exception ex) {
     }
 }
Beispiel #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!Turno.shiftActive)
            {
                return;
            }
            DarkForm          darkForm          = new DarkForm();
            Form_Login        formLogin         = new Form_Login(string.Format("Verificación De\nUsuario"));
            FormShiftAddMoney formShiftAddMoney = new FormShiftAddMoney();

            darkForm.Show();
            formLogin.ShowDialog();

            Empleado empleado = new Empleado(formLogin.ID);


            if (formLogin.DialogResult == DialogResult.OK && empleado.isAdmin)
            {
                if (formShiftAddMoney.ShowDialog() == DialogResult.OK)
                {
                    //<<< step1 >>> --Start
                    //When outputting to a printer,a mouse cursor becomes like a hourglass.


                    try
                    {
                        if (m_Drawer != null)
                        {
                            //Open the device
                            //Use a Logical Device Name which has been set on the SetupPOS.
                            m_Drawer.Open();

                            //Get the exclusive control right for the opened device.
                            //Then the device is disable from other application.
                            m_Drawer.Claim(1000);

                            //Enable the device.
                            m_Drawer.DeviceEnabled = true;
                            //Open the drawer by using the "OpenDrawer" method.
                            m_Drawer.OpenDrawer();


                            m_Drawer.DeviceEnabled = false;
                            m_Drawer.Release();
                            m_Drawer.Close();
                        }
                        else
                        {
                            useDefaultPrinter();
                        }
                    }
                    catch (Exception)
                    {
                        if (m_Drawer != null)
                        {
                            m_Drawer.Release();
                            m_Drawer.Close();
                        }
                        useDefaultPrinter();
                    }
                    //<<<step1>>>--End

                    Turno.AddCashToDrawer(empleado.ID, formShiftAddMoney.cash, formShiftAddMoney.reason);
                    MessageBox.Show("Se realizó correctamente");
                    this.setGroupBoxInfo();
                }
            }
            else if (formLogin.DialogResult == DialogResult.OK && !empleado.isAdmin && formLogin.ID > -1)
            {
                MessageBox.Show("No tiene los permisos necesarios para realizar esta acción");
            }
            darkForm.Close();
        }
Beispiel #10
0
 public void Claim()
 {
     _drawer.Claim(1000);
 }
Beispiel #11
0
        private void PayBtn_Click(object sender, EventArgs e)
        {
            if (this.PO.delivered)
            {
                FormPagar formPagar = new FormPagar(this.PO.total - this.PO.pay, true);
                DarkForm  darkForm  = new DarkForm();
                darkForm.Show();
                if (formPagar.ShowDialog() == DialogResult.OK)
                {
                    this.PO.MakePayment(Convert.ToDouble(formPagar.Pay), this.CurrentEmployeeID);
                    this.updateValues();

                    if (m_Drawer != null)
                    {
                        try
                        {
                            //Open the device
                            //Use a Logical Device Name which has been set on the SetupPOS.
                            m_Drawer.Open();

                            //Get the exclusive control right for the opened device.
                            //Then the device is disable from other application.
                            m_Drawer.Claim(1000);

                            //Enable the device.
                            m_Drawer.DeviceEnabled = true;

                            //Open the drawer by using the "OpenDrawer" method.
                            m_Drawer.OpenDrawer();


                            m_Drawer.DeviceEnabled = false;
                            m_Drawer.Release();

                            m_Drawer.Close();
                        }
                        catch (PosControlException)
                        { useNativePrinter(); }
                    }
                    else
                    {
                        useNativePrinter();
                    }


                    //<<<step1>>>--End
                    MessageBox.Show("Se realizó abono con exito");
                    if (this.PO.paid)
                    {
                        if (inASearch)
                        {
                            searchPO();
                        }
                        else
                        {
                            this.loadPurchases();
                        }
                    }
                }
                darkForm.Close();
            }
            else
            {
                MessageBox.Show("Primero debe confirmar el pedido para realizar un abono", "No se puede realizar un abono", MessageBoxButtons.OK);
            }
        }