OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 177 | Rev 182 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 177 Rev 180
Line 18... Line 18...
18
import org.openconcerto.erp.core.supplychain.stock.element.ComposedItemStockUpdater;
18
import org.openconcerto.erp.core.supplychain.stock.element.ComposedItemStockUpdater;
19
import org.openconcerto.erp.core.supplychain.stock.element.StockItem;
19
import org.openconcerto.erp.core.supplychain.stock.element.StockItem;
20
import org.openconcerto.erp.core.supplychain.stock.element.StockItem.TypeStockMouvement;
20
import org.openconcerto.erp.core.supplychain.stock.element.StockItem.TypeStockMouvement;
21
import org.openconcerto.sql.Configuration;
21
import org.openconcerto.sql.Configuration;
22
import org.openconcerto.sql.element.SQLElement;
22
import org.openconcerto.sql.element.SQLElement;
-
 
23
import org.openconcerto.sql.model.ConnectionHandlerNoSetup;
23
import org.openconcerto.sql.model.DBRoot;
24
import org.openconcerto.sql.model.DBRoot;
-
 
25
import org.openconcerto.sql.model.SQLDataSource;
24
import org.openconcerto.sql.model.SQLRow;
26
import org.openconcerto.sql.model.SQLRow;
25
import org.openconcerto.sql.model.SQLRowAccessor;
27
import org.openconcerto.sql.model.SQLRowAccessor;
26
import org.openconcerto.sql.model.SQLRowValues;
28
import org.openconcerto.sql.model.SQLRowValues;
27
import org.openconcerto.sql.model.SQLTable;
29
import org.openconcerto.sql.model.SQLTable;
28
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
30
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
Line 79... Line 81...
79
        comboStockDepart.uiInit(stockElt.createComboRequest());
81
        comboStockDepart.uiInit(stockElt.createComboRequest());
80
 
82
 
81
        final SQLRequestComboBox comboStockArrive = new SQLRequestComboBox();
83
        final SQLRequestComboBox comboStockArrive = new SQLRequestComboBox();
82
        comboStockArrive.uiInit(stockElt.createComboRequest());
84
        comboStockArrive.uiInit(stockElt.createComboRequest());
83
 
85
 
84
        JLabel qteReel = new JLabel("Quantité", SwingConstants.RIGHT);
-
 
85
        final NumericTextField fieldReel = new NumericTextField();
86
        final NumericTextField fieldReel = new NumericTextField();
86
 
87
 
87
        fieldReel.getDocument().addDocumentListener(new SimpleDocumentListener() {
88
        fieldReel.getDocument().addDocumentListener(new SimpleDocumentListener() {
88
 
89
 
89
            @Override
90
            @Override
90
            public void update(DocumentEvent e) {
91
            public void update(DocumentEvent e) {
91
                buttonUpdate.setEnabled(
-
 
92
                        fieldReel.getText().trim().length() > 0 && comboArticle.getSelectedRow() != null && comboStockArrive.getSelectedRow() != null && comboStockDepart.getSelectedRow() != null);
92
                updateButtons(buttonUpdate, comboArticle, comboStockDepart, comboStockArrive, fieldReel);
93
            }
93
            }
94
        });
94
        });
95
 
95
 
96
        comboArticle.addModelListener("wantedID", new PropertyChangeListener() {
96
        comboArticle.addModelListener("wantedID", new PropertyChangeListener() {
97
 
97
 
98
            @Override
98
            @Override
99
            public void propertyChange(PropertyChangeEvent evt) {
99
            public void propertyChange(PropertyChangeEvent evt) {
100
                buttonUpdate.setEnabled(
-
 
101
                        fieldReel.getText().trim().length() > 0 && comboArticle.getSelectedRow() != null && comboStockArrive.getSelectedRow() != null && comboStockDepart.getSelectedRow() != null);
100
                updateButtons(buttonUpdate, comboArticle, comboStockDepart, comboStockArrive, fieldReel);
102
            }
101
            }
103
        });
102
        });
104
 
103
 
105
        comboStockArrive.addModelListener("wantedID", new PropertyChangeListener() {
104
        comboStockArrive.addModelListener("wantedID", new PropertyChangeListener() {
106
 
105
 
107
            @Override
106
            @Override
108
            public void propertyChange(PropertyChangeEvent evt) {
107
            public void propertyChange(PropertyChangeEvent evt) {
109
                buttonUpdate.setEnabled(
-
 
110
                        fieldReel.getText().trim().length() > 0 && comboArticle.getSelectedRow() != null && comboStockArrive.getSelectedRow() != null && comboStockDepart.getSelectedRow() != null);
108
                updateButtons(buttonUpdate, comboArticle, comboStockDepart, comboStockArrive, fieldReel);
111
            }
109
            }
112
        });
110
        });
113
 
111
 
114
        comboStockDepart.addModelListener("wantedID", new PropertyChangeListener() {
112
        comboStockDepart.addModelListener("wantedID", new PropertyChangeListener() {
115
 
113
 
116
            @Override
114
            @Override
117
            public void propertyChange(PropertyChangeEvent evt) {
115
            public void propertyChange(PropertyChangeEvent evt) {
118
                buttonUpdate.setEnabled(
-
 
119
                        fieldReel.getText().trim().length() > 0 && comboArticle.getSelectedRow() != null && comboStockArrive.getSelectedRow() != null && comboStockDepart.getSelectedRow() != null);
116
                updateButtons(buttonUpdate, comboArticle, comboStockDepart, comboStockArrive, fieldReel);
120
            }
117
            }
121
        });
118
        });
122
 
119
 
123
        GridBagConstraints c = new DefaultGridBagConstraints();
120
        GridBagConstraints c = new DefaultGridBagConstraints();
124
 
-
 
-
 
121
        c.gridx = 0;
125
        this.add(new JLabel("Intitulé"), c);
122
        this.add(new JLabel("Intitulé"), c);
126
        final JTextField label = new JTextField();
123
        final JTextField label = new JTextField();
127
        c.gridx++;
124
        c.gridx++;
128
        c.gridwidth = 2;
125
        c.gridwidth = 1;
129
        c.weightx = 1;
126
        c.weightx = 1;
130
        this.add(label, c);
127
        this.add(label, c);
131
        label.setText(defaultLabel);
128
        label.setText(defaultLabel);
132
 
129
 
133
        c.gridy++;
130
        c.gridy++;
134
        c.gridx = 0;
131
        c.gridx = 0;
135
        c.gridwidth = 1;
-
 
136
        c.weightx = 0;
132
        c.weightx = 0;
137
        this.add(new JLabel("Date", SwingConstants.RIGHT), c);
133
        this.add(new JLabel("Date", SwingConstants.RIGHT), c);
138
        final JDate date = new JDate(true);
134
        final JDate date = new JDate(true);
139
        c.gridx++;
135
        c.gridx++;
140
        c.weightx = 0;
-
 
141
        this.add(date, c);
136
        this.add(date, c);
142
 
137
 
143
        c.gridy++;
138
        c.gridy++;
144
        c.gridx = 0;
139
        c.gridx = 0;
145
        c.gridwidth = 2;
-
 
146
        c.weightx = 0;
140
        c.weightx = 0;
147
        this.add(new JLabel("Article", SwingConstants.RIGHT), c);
141
        this.add(new JLabel("Article", SwingConstants.RIGHT), c);
148
        c.gridx += 2;
142
        c.gridx++;
149
        c.gridwidth = 1;
-
 
150
        c.weightx = 1;
-
 
151
        this.add(comboArticle, c);
143
        this.add(comboArticle, c);
152
 
144
 
153
        c.gridy++;
145
        c.gridy++;
154
        c.gridx = 0;
146
        c.gridx = 0;
155
        c.gridwidth = 2;
-
 
156
        c.weightx = 0;
147
        c.weightx = 0;
157
        this.add(new JLabel("Départ", SwingConstants.RIGHT), c);
148
        this.add(new JLabel("Départ", SwingConstants.RIGHT), c);
158
        c.gridx += 2;
149
        c.gridx++;
159
        c.gridwidth = 1;
-
 
160
        c.weightx = 1;
-
 
161
        this.add(comboStockDepart, c);
150
        this.add(comboStockDepart, c);
162
 
151
 
163
        c.gridy++;
152
        c.gridy++;
164
        c.gridx = 0;
153
        c.gridx = 0;
165
        c.gridwidth = 2;
-
 
166
        c.weightx = 0;
154
        c.weightx = 0;
-
 
155
 
167
        this.add(new JLabel("Arrivée", SwingConstants.RIGHT), c);
156
        this.add(new JLabel("Arrivée", SwingConstants.RIGHT), c);
168
        c.gridx += 2;
157
        c.gridx++;
169
        c.gridwidth = 1;
-
 
170
        c.weightx = 1;
-
 
171
        this.add(comboStockArrive, c);
158
        this.add(comboStockArrive, c);
172
 
159
 
173
        c.gridy++;
160
        c.gridy++;
174
        c.gridx = 0;
161
        c.gridx = 0;
175
        c.gridwidth = 2;
-
 
176
        c.weightx = 0;
-
 
177
        this.add(qteReel, c);
-
 
178
        c.gridx += 2;
-
 
179
        c.gridwidth = 1;
-
 
180
        c.weightx = 1;
-
 
181
        this.add(fieldReel, c);
-
 
182
 
-
 
183
        c.gridy++;
-
 
184
        c.gridx = 0;
-
 
185
        c.gridwidth = 2;
-
 
186
        c.weightx = 0;
162
        c.weightx = 0;
187
        this.add(qteReel, c);
163
        this.add(new JLabel("Quantité", SwingConstants.RIGHT), c);
188
        c.gridx += 2;
164
        c.gridx++;
189
        c.gridwidth = 1;
-
 
190
        c.weightx = 1;
-
 
191
        this.add(fieldReel, c);
165
        this.add(fieldReel, c);
192
 
166
 
193
        c.gridy++;
167
        c.gridy++;
194
        c.gridx = 0;
168
        c.gridx = 0;
195
        JButton buttonCancel = new JButton("Annuler");
169
        JButton buttonCancel = new JButton("Annuler");
196
        JPanel pButton = new JPanel();
170
        JPanel pButton = new JPanel();
197
        pButton.add(buttonCancel);
171
        pButton.add(buttonCancel);
198
        pButton.add(buttonUpdate);
172
        pButton.add(buttonUpdate);
199
        c.gridwidth = GridBagConstraints.REMAINDER;
173
        c.gridwidth = 2;
200
        c.anchor = GridBagConstraints.EAST;
174
        c.anchor = GridBagConstraints.SOUTHEAST;
201
        c.weightx = 0;
175
        c.weightx = 0;
202
        c.fill = GridBagConstraints.NONE;
176
        c.fill = GridBagConstraints.NONE;
203
        this.add(pButton, c);
177
        this.add(pButton, c);
204
        buttonCancel.addActionListener(new ActionListener() {
178
        buttonCancel.addActionListener(new ActionListener() {
205
 
179
 
Line 210... Line 184...
210
        });
184
        });
211
        buttonUpdate.addActionListener(new ActionListener() {
185
        buttonUpdate.addActionListener(new ActionListener() {
212
 
186
 
213
            @Override
187
            @Override
214
            public void actionPerformed(ActionEvent e) {
188
            public void actionPerformed(ActionEvent e) {
215
 
-
 
216
                buttonUpdate.setEnabled(false);
189
                buttonUpdate.setEnabled(false);
217
                BigDecimal qteReel = fieldReel.getValue();
190
                BigDecimal qteReel = fieldReel.getValue();
218
 
-
 
219
                List<String> multipleRequestsHundred = new ArrayList<String>(100);
191
                List<String> multipleRequestsHundred = new ArrayList<String>(100);
220
                boolean usePrice = mvtStockTable.contains("PRICE");
192
                boolean usePrice = mvtStockTable.contains("PRICE");
221
                List<StockItem> stockItems = new ArrayList<StockItem>();
193
                List<StockItem> stockItems = new ArrayList<StockItem>();
222
                final Date dateValue = date.getValue();
194
                final Date dateValue = date.getValue();
223
 
-
 
224
                final SQLRow selectedRowArticle = comboArticle.getSelectedRow();
195
                final SQLRow selectedRowArticle = comboArticle.getSelectedRow();
225
 
-
 
226
                final SQLRow selectedRowDepotDepart = comboStockDepart.getSelectedRow();
196
                final SQLRow selectedRowDepotDepart = comboStockDepart.getSelectedRow();
227
                final SQLRow selectedRowDepotArrivee = comboStockArrive.getSelectedRow();
197
                final SQLRow selectedRowDepotArrivee = comboStockArrive.getSelectedRow();
-
 
198
                try {
-
 
199
                    SQLUtils.executeAtomic(selectedRowDepotDepart.getTable().getDBSystemRoot().getDataSource(), new ConnectionHandlerNoSetup<Object, SQLException>() {
-
 
200
                        @Override
-
 
201
                        public Object handle(SQLDataSource ds) throws SQLException {
228
                {
202
                            {
229
                    // DEPART
203
                                // DEPART
230
                    final SQLRowAccessor rowStockDepart = ProductComponent.findOrCreateStock(selectedRowArticle, selectedRowDepotDepart);
204
                                final SQLRowAccessor rowStockDepart = ProductComponent.findOrCreateStock(selectedRowArticle, selectedRowDepotDepart);
231
                    StockItem item = new StockItem(selectedRowArticle, rowStockDepart);
205
                                StockItem item = new StockItem(selectedRowArticle, rowStockDepart);
232
                    if (!item.isStockInit()) {
206
                                if (!item.isStockInit()) {
233
                        SQLRowValues rowVals = new SQLRowValues(mvtStockTable.getTable("STOCK"));
207
                                    SQLRowValues rowVals = new SQLRowValues(mvtStockTable.getTable("STOCK"));
234
                        rowVals.put("ID_ARTICLE", selectedRowArticle.getID());
208
                                    rowVals.put("ID_ARTICLE", selectedRowArticle.getID());
235
                        rowVals.put("ID_DEPOT_STOCK", selectedRowDepotDepart.getID());
209
                                    rowVals.put("ID_DEPOT_STOCK", selectedRowDepotDepart.getID());
236
                        try {
-
 
237
                            rowVals.commit();
210
                                    rowVals.commit();
238
                        } catch (SQLException e1) {
-
 
239
                            // TODO Auto-generated catch block
-
 
240
                            e1.printStackTrace();
-
 
241
                        }
-
 
242
                        selectedRowArticle.fetchValues();
211
                                    selectedRowArticle.fetchValues();
243
                        item = new StockItem(selectedRowArticle, rowStockDepart);
212
                                    item = new StockItem(selectedRowArticle, rowStockDepart);
244
                    }
213
                                }
245
                    stockItems.add(item);
214
                                stockItems.add(item);
246
                    double diff = -qteReel.doubleValue();
215
                                double diff = -qteReel.doubleValue();
247
                    item.updateQty(diff, TypeStockMouvement.REEL);
216
                                item.updateQty(diff, TypeStockMouvement.REEL);
-
 
217
                                multipleRequestsHundred
248
                    multipleRequestsHundred.add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(label.getText(), selectedRowDepotDepart, selectedRowDepotArrivee), true, usePrice));
218
                                        .add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(label.getText(), selectedRowDepotDepart, selectedRowDepotArrivee), true, usePrice));
249
 
-
 
250
                    item.updateQty(diff, TypeStockMouvement.THEORIQUE);
219
                                item.updateQty(diff, TypeStockMouvement.THEORIQUE);
-
 
220
                                multipleRequestsHundred
251
                    multipleRequestsHundred.add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(label.getText(), selectedRowDepotDepart, selectedRowDepotArrivee), false, usePrice));
221
                                        .add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(label.getText(), selectedRowDepotDepart, selectedRowDepotArrivee), false, usePrice));
252
 
-
 
253
                    multipleRequestsHundred.add(item.getUpdateRequest());
222
                                multipleRequestsHundred.add(item.getUpdateRequest());
254
                }
223
                            }
255
                // ARRIVEE
224
                            // ARRIVEE
256
                {
225
                            {
257
                    final SQLRowAccessor rowStockArrivee = ProductComponent.findOrCreateStock(selectedRowArticle, selectedRowDepotArrivee);
226
                                final SQLRowAccessor rowStockArrivee = ProductComponent.findOrCreateStock(selectedRowArticle, selectedRowDepotArrivee);
258
 
-
 
259
                    StockItem item = new StockItem(selectedRowArticle, rowStockArrivee);
227
                                StockItem item = new StockItem(selectedRowArticle, rowStockArrivee);
260
                    if (!item.isStockInit()) {
228
                                if (!item.isStockInit()) {
261
                        SQLRowValues rowVals = new SQLRowValues(mvtStockTable.getTable("STOCK"));
229
                                    SQLRowValues rowVals = new SQLRowValues(mvtStockTable.getTable("STOCK"));
262
                        rowVals.put("ID_ARTICLE", selectedRowArticle.getID());
230
                                    rowVals.put("ID_ARTICLE", selectedRowArticle.getID());
263
                        rowVals.put("ID_DEPOT_STOCK", selectedRowDepotArrivee.getID());
231
                                    rowVals.put("ID_DEPOT_STOCK", selectedRowDepotArrivee.getID());
264
                        try {
-
 
265
                            rowVals.commit();
232
                                    rowVals.commit();
266
                        } catch (SQLException e1) {
-
 
267
                            // TODO Auto-generated catch block
-
 
268
                            e1.printStackTrace();
-
 
269
                        }
-
 
270
                        selectedRowArticle.fetchValues();
233
                                    selectedRowArticle.fetchValues();
271
                        item = new StockItem(selectedRowArticle, rowStockArrivee);
234
                                    item = new StockItem(selectedRowArticle, rowStockArrivee);
272
                    }
235
                                }
273
                    stockItems.add(item);
236
                                stockItems.add(item);
274
                    double diff = qteReel.doubleValue();
237
                                double diff = qteReel.doubleValue();
275
                    item.updateQty(diff, TypeStockMouvement.REEL);
238
                                item.updateQty(diff, TypeStockMouvement.REEL);
-
 
239
                                multipleRequestsHundred
276
                    multipleRequestsHundred.add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(label.getText(), selectedRowDepotDepart, selectedRowDepotArrivee), true, usePrice));
240
                                        .add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(label.getText(), selectedRowDepotDepart, selectedRowDepotArrivee), true, usePrice));
277
 
-
 
278
                    item.updateQty(diff, TypeStockMouvement.THEORIQUE);
241
                                item.updateQty(diff, TypeStockMouvement.THEORIQUE);
-
 
242
                                multipleRequestsHundred
279
                    multipleRequestsHundred.add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(label.getText(), selectedRowDepotDepart, selectedRowDepotArrivee), false, usePrice));
243
                                        .add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(label.getText(), selectedRowDepotDepart, selectedRowDepotArrivee), false, usePrice));
280
 
-
 
281
                    multipleRequestsHundred.add(item.getUpdateRequest());
244
                                multipleRequestsHundred.add(item.getUpdateRequest());
282
                }
245
                            }
283
 
246
 
284
                try {
-
 
285
 
-
 
286
                    final int size = multipleRequestsHundred.size();
247
                            final int size = multipleRequestsHundred.size();
287
                    List<? extends ResultSetHandler> handlers = new ArrayList<ResultSetHandler>(size);
248
                            List<? extends ResultSetHandler> handlers = new ArrayList<ResultSetHandler>(size);
288
                    for (int i = 0; i < size; i++) {
249
                            for (int i = 0; i < size; i++) {
289
                        handlers.add(null);
250
                                handlers.add(null);
290
                    }
251
                            }
291
                    SQLUtils.executeMultiple(instance.getRoot().getDBSystemRoot(), multipleRequestsHundred, handlers);
252
                            SQLUtils.executeMultiple(instance.getRoot().getDBSystemRoot(), multipleRequestsHundred, handlers);
292
 
253
 
293
                } catch (SQLException e1) {
-
 
294
                    ExceptionHandler.handle("Stock update error", e1);
-
 
295
                }
-
 
296
 
-
 
297
                final DBRoot root = mvtStockTable.getDBRoot();
254
                            final DBRoot root = mvtStockTable.getDBRoot();
298
                if (root.contains("ARTICLE_ELEMENT")) {
255
                            if (root.contains("ARTICLE_ELEMENT")) {
299
                    // List<StockItem> stockItems = new ArrayList<StockItem>();
-
 
300
                    // for (SQLRowAccessor sqlRowAccessor2 : stocks) {
-
 
301
                    // final SQLRow asRow = sqlRowAccessor2.asRow();
-
 
302
                    // asRow.fetchValues();
-
 
303
                    // stockItems.add(new StockItem(asRow));
-
 
304
                    // }
-
 
305
                    // Mise à jour des stocks des nomenclatures
256
                                // Mise à jour des stocks des nomenclatures
306
                    ComposedItemStockUpdater comp = new ComposedItemStockUpdater(root, stockItems);
257
                                ComposedItemStockUpdater comp = new ComposedItemStockUpdater(root, stockItems);
307
                    try {
-
 
308
                        comp.update();
258
                                comp.update();
309
                    } catch (SQLException e1) {
-
 
310
                        e1.printStackTrace();
-
 
311
                    }
259
                            }
-
 
260
                            return null;
-
 
261
                        }
-
 
262
                    });
-
 
263
                } catch (SQLException e1) {
-
 
264
                    ExceptionHandler.handle("Stock update error", e1);
312
                }
265
                }
313
 
-
 
314
                // liste.getModel().updateAll();
-
 
315
                ((JFrame) SwingUtilities.getRoot(TransfertStockPanel.this)).dispose();
266
                ((JFrame) SwingUtilities.getRoot(TransfertStockPanel.this)).dispose();
316
            }
267
            }
317
        });
268
        });
318
    }
269
    }
319
 
270
 
320
    private String getLabel(String label, SQLRowAccessor fromDepot, SQLRowAccessor toDepot) {
271
    private String getLabel(String label, SQLRowAccessor fromDepot, SQLRowAccessor toDepot) {
321
 
-
 
322
        return label + " de " + fromDepot.getString("NOM") + " vers " + toDepot.getString("NOM");
272
        return label + " de " + fromDepot.getString("NOM") + " vers " + toDepot.getString("NOM");
323
 
-
 
324
    }
273
    }
325
 
274
 
326
    private String getMvtRequest(Date time, BigDecimal prc, double qteFinal, StockItem item, String label, boolean reel, boolean usePrice) {
275
    private String getMvtRequest(Date time, BigDecimal prc, double qteFinal, StockItem item, String label, boolean reel, boolean usePrice) {
327
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
276
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
328
        String mvtStockQuery = "INSERT INTO " + mvtStockTableQuoted + " (\"QTE\",\"DATE\",\"ID_ARTICLE\",\"ID_STOCK\",\"NOM\",\"REEL\",\"ORDRE\"";
277
        String mvtStockQuery = "INSERT INTO " + this.mvtStockTableQuoted + " (\"QTE\",\"DATE\",\"ID_ARTICLE\",\"ID_STOCK\",\"NOM\",\"REEL\",\"ORDRE\"";
329
 
278
 
330
        if (usePrice && prc != null) {
279
        if (usePrice && prc != null) {
331
            mvtStockQuery += ",\"PRICE\"";
280
            mvtStockQuery += ",\"PRICE\"";
332
        }
281
        }
333
 
282
 
334
        mvtStockQuery += ") VALUES(" + qteFinal + ",'" + dateFormat.format(time) + "'," + item.getArticle().getID() + "," + item.stock.getID() + ",'" + label + "'," + reel
283
        mvtStockQuery += ") VALUES(" + qteFinal + ",'" + dateFormat.format(time) + "'," + item.getArticle().getID() + "," + item.stock.getID() + ",'" + label + "'," + reel
335
                + ", (SELECT (MAX(\"ORDRE\")+1) FROM " + mvtStockTableQuoted + ")";
284
                + ", (SELECT (MAX(\"ORDRE\")+1) FROM " + this.mvtStockTableQuoted + ")";
336
        if (usePrice && prc != null) {
285
        if (usePrice && prc != null) {
337
            mvtStockQuery += "," + prc.setScale(6, RoundingMode.HALF_UP).toString();
286
            mvtStockQuery += "," + prc.setScale(6, RoundingMode.HALF_UP).toString();
338
        }
287
        }
339
        mvtStockQuery += ")";
288
        mvtStockQuery += ")";
340
        return mvtStockQuery;
289
        return mvtStockQuery;
341
    }
290
    }
-
 
291
 
-
 
292
    private void updateButtons(final JButton buttonUpdate, final SQLRequestComboBox comboArticle, final SQLRequestComboBox comboStockDepart, final SQLRequestComboBox comboStockArrive,
-
 
293
            final NumericTextField fieldReel) {
-
 
294
        buttonUpdate.setEnabled(fieldReel.getText().trim().length() > 0 && comboArticle.getSelectedRow() != null && comboStockArrive.getSelectedRow() != null
-
 
295
                && comboStockDepart.getSelectedRow() != null && comboStockArrive.getSelectedRow().getID() != comboStockDepart.getSelectedRow().getID());
-
 
296
    }
342
}
297
}