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 49... |
Line 49... |
49 |
import javax.swing.JFrame;
|
49 |
import javax.swing.JFrame;
|
50 |
import javax.swing.JOptionPane;
|
50 |
import javax.swing.JOptionPane;
|
51 |
import javax.swing.SwingWorker;
|
51 |
import javax.swing.SwingWorker;
|
52 |
|
52 |
|
53 |
import org.apache.commons.dbutils.handlers.ArrayListHandler;
|
53 |
import org.apache.commons.dbutils.handlers.ArrayListHandler;
|
- |
|
54 |
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater;
|
- |
|
55 |
import org.openconcerto.erp.core.supplychain.stock.element.StockLabel;
|
- |
|
56 |
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater.TypeStockUpdate;
|
- |
|
57 |
import org.openconcerto.sql.model.SQLRowAccessor;
|
54 |
|
58 |
|
55 |
public class BonReceptionSQLElement extends ComptaSQLConfElement {
|
59 |
public class BonReceptionSQLElement extends ComptaSQLConfElement {
|
56 |
|
60 |
|
57 |
public BonReceptionSQLElement() {
|
61 |
public BonReceptionSQLElement() {
|
58 |
super("BON_RECEPTION", "un bon de réception", "bons de réception");
|
62 |
super("BON_RECEPTION", "un bon de réception", "bons de réception");
|
Line 110... |
Line 114... |
110 |
actionTRSimple.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
114 |
actionTRSimple.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
111 |
|
115 |
|
112 |
getRowActions().add(actionsTRFA);
|
116 |
getRowActions().add(actionsTRFA);
|
113 |
getRowActions().add(actionTRSimple);
|
117 |
getRowActions().add(actionTRSimple);
|
114 |
|
118 |
|
115 |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(BonReceptionXmlSheet.class);
|
119 |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(this, BonReceptionXmlSheet.class);
|
116 |
mouseSheetXmlListeListener.setGenerateHeader(true);
|
120 |
mouseSheetXmlListeListener.setGenerateHeader(true);
|
117 |
mouseSheetXmlListeListener.setShowHeader(true);
|
121 |
mouseSheetXmlListeListener.setShowHeader(true);
|
118 |
getRowActions().addAll(mouseSheetXmlListeListener.getRowActions());
|
122 |
getRowActions().addAll(mouseSheetXmlListeListener.getRowActions());
|
119 |
}
|
123 |
}
|
120 |
|
124 |
|
Line 224... |
Line 228... |
224 |
|
228 |
|
225 |
@Override
|
229 |
@Override
|
226 |
protected String createCodeSuffix() {
|
230 |
protected String createCodeSuffix() {
|
227 |
return ".note";
|
231 |
return ".note";
|
228 |
}
|
232 |
}
|
- |
|
233 |
|
- |
|
234 |
/**
|
- |
|
235 |
* Mise à jour des stocks pour chaque article composant du bon
|
- |
|
236 |
*
|
- |
|
237 |
* @throws SQLException
|
- |
|
238 |
*/
|
- |
|
239 |
public void updateStock(int id) throws SQLException {
|
- |
|
240 |
|
- |
|
241 |
SQLRow row = getTable().getRow(id);
|
- |
|
242 |
StockItemsUpdater stockUpdater = new StockItemsUpdater(new StockLabel() {
|
- |
|
243 |
|
- |
|
244 |
@Override
|
- |
|
245 |
public String getLabel(SQLRowAccessor rowOrigin, SQLRowAccessor rowElt) {
|
- |
|
246 |
|
- |
|
247 |
return getLibelleStock(rowOrigin, rowElt);
|
- |
|
248 |
}
|
- |
|
249 |
}, row, row.getReferentRows(getTable().getTable("BON_RECEPTION_ELEMENT")),
|
- |
|
250 |
getTable().contains("CREATE_VIRTUAL_STOCK") && row.getBoolean("CREATE_VIRTUAL_STOCK") ? TypeStockUpdate.REAL_VIRTUAL_RECEPT : TypeStockUpdate.REAL_RECEPT);
|
- |
|
251 |
|
- |
|
252 |
if (getTable().getDBRoot().contains("RELIQUAT_BR")) {
|
- |
|
253 |
List<SQLRow> l = row.getReferentRows(getTable().getTable("RELIQUAT_BR").getField("ID_BON_RECEPTION_ORIGINE"));
|
- |
|
254 |
for (SQLRow sqlRow : l) {
|
- |
|
255 |
stockUpdater.addReliquat(sqlRow.getForeign("ID_ARTICLE"), sqlRow.getInt("QTE"), sqlRow.getBigDecimal("QTE_UNITAIRE"));
|
- |
|
256 |
}
|
- |
|
257 |
}
|
- |
|
258 |
|
- |
|
259 |
stockUpdater.update();
|
- |
|
260 |
|
- |
|
261 |
}
|
- |
|
262 |
|
- |
|
263 |
public String getLibelleStock(SQLRowAccessor row, SQLRowAccessor rowElt) {
|
- |
|
264 |
return "Bon de réception N°" + row.getString("NUMERO");
|
- |
|
265 |
}
|
229 |
}
|
266 |
}
|