OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 177 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 177 Rev 182
Line 1... Line 1...
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
9
 * language governing permissions and limitations under the License.
Line 14... Line 14...
14
 package org.openconcerto.erp.core.sales.pos.ui;
14
 package org.openconcerto.erp.core.sales.pos.ui;
15
 
15
 
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
17
import org.openconcerto.erp.config.Gestion;
17
import org.openconcerto.erp.config.Gestion;
18
import org.openconcerto.erp.core.sales.pos.POSConfiguration;
18
import org.openconcerto.erp.core.sales.pos.POSConfiguration;
-
 
19
import org.openconcerto.erp.core.sales.pos.model.Article;
19
import org.openconcerto.erp.core.sales.pos.model.Client;
20
import org.openconcerto.erp.core.sales.pos.model.Client;
20
import org.openconcerto.erp.core.sales.pos.model.DBState;
21
import org.openconcerto.erp.core.sales.pos.model.DBState;
-
 
22
import org.openconcerto.erp.core.sales.pos.model.Paiement;
21
import org.openconcerto.erp.core.sales.pos.model.ReceiptCode;
23
import org.openconcerto.erp.core.sales.pos.model.ReceiptCode;
22
import org.openconcerto.erp.core.sales.pos.model.RegisterDB;
24
import org.openconcerto.erp.core.sales.pos.model.RegisterDB;
23
import org.openconcerto.erp.core.sales.pos.model.RegisterFiles;
25
import org.openconcerto.erp.core.sales.pos.model.RegisterFiles;
24
import org.openconcerto.erp.core.sales.pos.model.RegisterLog;
26
import org.openconcerto.erp.core.sales.pos.model.RegisterLog;
25
import org.openconcerto.erp.core.sales.pos.model.RegisterState;
27
import org.openconcerto.erp.core.sales.pos.model.RegisterState;
Line 50... Line 52...
50
import java.net.MalformedURLException;
52
import java.net.MalformedURLException;
51
import java.sql.SQLException;
53
import java.sql.SQLException;
52
import java.text.ParseException;
54
import java.text.ParseException;
53
import java.util.EnumSet;
55
import java.util.EnumSet;
54
import java.util.List;
56
import java.util.List;
-
 
57
import java.util.Map;
55
import java.util.Objects;
58
import java.util.Objects;
56
import java.util.Set;
59
import java.util.Set;
57
import java.util.concurrent.Callable;
60
import java.util.concurrent.Callable;
58
import java.util.concurrent.FutureTask;
61
import java.util.concurrent.FutureTask;
59
import java.util.logging.Level;
62
import java.util.logging.Level;
Line 246... Line 249...
246
                        f.setVisible(true);
249
                        f.setVisible(true);
247
                        if (screenSize.getWidth() < 1024 || screenSize.getHeight() < 720) {
250
                        if (screenSize.getWidth() < 1024 || screenSize.getHeight() < 720) {
248
                            JOptionPane.showMessageDialog(f,
251
                            JOptionPane.showMessageDialog(f,
249
                                    "La résolution de votre écran est trop faible.\nLa largeur doit être au minium de 1024 pixels.\nLa hauteur doit être au minium de 720 pixels.");
252
                                    "La résolution de votre écran est trop faible.\nLa largeur doit être au minium de 1024 pixels.\nLa hauteur doit être au minium de 720 pixels.");
250
                        }
253
                        }
-
 
254
 
-
 
255
                        // if(
-
 
256
                        // registerFiles.getLastLog().getLastFundEvent(EventType.CASHFUND_OPENING)
-
 
257
                        // == null ) {
-
 
258
                        // TODO f.showComptage(EventType.CASHFUND_OPENING, f.getControler());
-
 
259
                        // }
251
                    } catch (Throwable e) {
260
                    } catch (Throwable e) {
252
                        // Catch throwable to be able to see NoClassDefFound and other hard issues
261
                        // Catch throwable to be able to see NoClassDefFound and other hard issues
253
                        ExceptionHandler.handle("Erreur d'initialisation de la caisse (main)", e);
262
                        ExceptionHandler.handle("Erreur d'initialisation de la caisse (main)", e);
254
                    }
263
                    }
255
 
264
 
Line 455... Line 464...
455
        if (!remoteState.equals(localState))
464
        if (!remoteState.equals(localState))
456
            throw new IllegalStateException("Unexpected state");
465
            throw new IllegalStateException("Unexpected state");
457
        return remoteState;
466
        return remoteState;
458
    }
467
    }
459
 
468
 
460
    static public void quit(final POSConfiguration posConf) {
469
    public static void quit(final POSConfiguration posConf) {
461
        POSConfiguration.getLogger().log(Level.INFO, "User exit");
470
        POSConfiguration.getLogger().log(Level.INFO, "User exit");
462
        posConf.closeConnexion();
471
        posConf.closeConnexion();
463
        Frame[] l = Frame.getFrames();
472
        Frame[] l = Frame.getFrames();
464
        for (int i = 0; i < l.length; i++) {
473
        for (int i = 0; i < l.length; i++) {
465
            Frame f = l[i];
474
            Frame f = l[i];
Line 589... Line 598...
589
        final POSGlassPane glassPane2 = new POSGlassPane(panel, (getWidth() - panel.getPreferredSize().width) / 2, 100);
598
        final POSGlassPane glassPane2 = new POSGlassPane(panel, (getWidth() - panel.getPreferredSize().width) / 2, 100);
590
        this.setGlassPane(glassPane2);
599
        this.setGlassPane(glassPane2);
591
        this.getGlassPane().setVisible(true);
600
        this.getGlassPane().setVisible(true);
592
        this.validate();
601
        this.validate();
593
        this.repaint();
602
        this.repaint();
-
 
603
    }
-
 
604
 
-
 
605
    public void showCBPanel(Paiement p) {
-
 
606
        getControler().disableBarcodeReader();
-
 
607
        System.out.println("CaisseFrame.showCBPanel()");
-
 
608
        this.invalidate();
-
 
609
        final CBPanel panel = new CBPanel(this, this.getControler(), p);
-
 
610
 
-
 
611
        final POSGlassPane glassPane2 = new POSGlassPane(panel, (getWidth() - panel.getPreferredSize().width) / 2, 100);
-
 
612
        this.setGlassPane(glassPane2);
-
 
613
        this.getGlassPane().setVisible(true);
-
 
614
        this.validate();
-
 
615
        this.repaint();
-
 
616
    }
-
 
617
 
-
 
618
    public void showArticleSelector(List<Article> list, ArticleSelectionListener articleSelectionListener) {
-
 
619
        getControler().disableBarcodeReader();
-
 
620
 
-
 
621
        this.invalidate();
-
 
622
        final ArticleSelectorDialogPanel panel = new ArticleSelectorDialogPanel(this, list, articleSelectionListener);
-
 
623
 
-
 
624
        final int x = (getWidth() - panel.getPreferredSize().width) / 2;
-
 
625
        final int y = 100;
-
 
626
        System.out.println("CaisseFrame.showArticleSelector() at " + x + "," + y + " " + panel.getPreferredSize().width + "x" + panel.getPreferredSize().height + " : " + list.size()
-
 
627
                + " products (barcode : " + list.get(0).getBarCode() + ")");
-
 
628
        final POSGlassPane glassPane2 = new POSGlassPane(panel, x, y);
-
 
629
        this.setGlassPane(glassPane2);
-
 
630
        this.getGlassPane().setVisible(true);
-
 
631
        this.validate();
-
 
632
        this.repaint();
-
 
633
 
-
 
634
    }
-
 
635
 
-
 
636
    public void showStockErrorPanel(Map<TicketItem, Integer> missingQty, Runnable runnable) {
-
 
637
        getControler().disableBarcodeReader();
-
 
638
 
-
 
639
        this.invalidate();
-
 
640
        final StockErrorPanel panel = new StockErrorPanel(this, missingQty, runnable);
-
 
641
 
-
 
642
        final int x = (getWidth() - panel.getPreferredSize().width) / 2;
-
 
643
        final int y = 100;
-
 
644
        System.out.println("CaisseFrame.showStockErrorPanel() at " + x + "," + y + " " + panel.getPreferredSize().width + "x" + panel.getPreferredSize().height + " : " + missingQty.size());
-
 
645
        final POSGlassPane glassPane2 = new POSGlassPane(panel, x, y);
-
 
646
        this.setGlassPane(glassPane2);
-
 
647
        this.getGlassPane().setVisible(true);
-
 
648
        this.validate();
-
 
649
        this.repaint();
-
 
650
 
-
 
651
    }
-
 
652
 
-
 
653
    public void showTicketClientNamePanel(Ticket ticket) {
-
 
654
        getControler().disableBarcodeReader();
-
 
655
 
-
 
656
        this.invalidate();
-
 
657
        final TicketClientNamePanel panel = new TicketClientNamePanel(this, ticket);
-
 
658
 
-
 
659
        final int x = (getWidth() - panel.getPreferredSize().width) / 2;
-
 
660
        final int y = 100;
-
 
661
        System.out.println("CaisseFrame.showTicketClientNamePanel() at " + x + "," + y + " " + panel.getPreferredSize().width + "x" + panel.getPreferredSize().height + " : " + ticket);
-
 
662
        final POSGlassPane glassPane2 = new POSGlassPane(panel, x, y);
-
 
663
        this.setGlassPane(glassPane2);
-
 
664
        this.getGlassPane().setVisible(true);
-
 
665
        this.validate();
-
 
666
        this.repaint();
594
 
667
 
595
    }
668
    }
596
}
669
}