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 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.
|
10 |
*
|
10 |
*
|
11 |
* When distributing the software, include this License Header Notice in each file.
|
11 |
* When distributing the software, include this License Header Notice in each file.
|
12 |
*/
|
12 |
*/
|
13 |
|
13 |
|
14 |
package org.openconcerto.erp.core.supplychain.stock.element;
|
14 |
package org.openconcerto.erp.core.supplychain.stock.element;
|
15 |
|
15 |
|
16 |
import org.openconcerto.erp.core.sales.product.model.ProductComponent;
|
16 |
import org.openconcerto.erp.core.sales.product.model.ProductComponent;
|
17 |
import org.openconcerto.erp.core.sales.product.model.ProductHelper;
|
17 |
import org.openconcerto.erp.core.sales.product.model.ProductHelper;
|
18 |
import org.openconcerto.erp.core.sales.product.model.ProductHelper.SupplierPriceField;
|
18 |
import org.openconcerto.erp.core.sales.product.model.ProductHelper.SupplierPriceField;
|
19 |
import org.openconcerto.erp.importer.ArrayTableModel;
|
19 |
import org.openconcerto.erp.importer.ArrayTableModel;
|
20 |
import org.openconcerto.erp.importer.DataImporter;
|
20 |
import org.openconcerto.erp.importer.DataImporter;
|
21 |
import org.openconcerto.sql.Configuration;
|
21 |
import org.openconcerto.sql.Configuration;
|
22 |
import org.openconcerto.sql.model.DBRoot;
|
22 |
import org.openconcerto.sql.model.DBRoot;
|
23 |
import org.openconcerto.sql.model.SQLRow;
|
23 |
import org.openconcerto.sql.model.SQLRow;
|
24 |
import org.openconcerto.sql.model.SQLRowAccessor;
|
24 |
import org.openconcerto.sql.model.SQLRowAccessor;
|
25 |
import org.openconcerto.sql.model.SQLRowValues;
|
25 |
import org.openconcerto.sql.model.SQLRowValues;
|
26 |
import org.openconcerto.sql.model.SQLRowValuesCluster.StoreMode;
|
26 |
import org.openconcerto.sql.model.SQLRowValuesCluster.StoreMode;
|
27 |
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
|
27 |
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
|
28 |
import org.openconcerto.sql.model.SQLTable;
|
28 |
import org.openconcerto.sql.model.SQLTable;
|
29 |
import org.openconcerto.sql.utils.SQLUtils;
|
29 |
import org.openconcerto.sql.utils.SQLUtils;
|
30 |
import org.openconcerto.utils.Tuple2;
|
30 |
import org.openconcerto.utils.Tuple2;
|
31 |
|
31 |
|
32 |
import java.io.File;
|
32 |
import java.io.File;
|
33 |
import java.io.IOException;
|
33 |
import java.io.IOException;
|
34 |
import java.math.BigDecimal;
|
34 |
import java.math.BigDecimal;
|
35 |
import java.sql.SQLException;
|
35 |
import java.sql.SQLException;
|
36 |
import java.util.ArrayList;
|
36 |
import java.util.ArrayList;
|
37 |
import java.util.Calendar;
|
37 |
import java.util.Calendar;
|
38 |
import java.util.Collection;
|
38 |
import java.util.Collection;
|
39 |
import java.util.Date;
|
39 |
import java.util.Date;
|
40 |
import java.util.HashMap;
|
40 |
import java.util.HashMap;
|
41 |
import java.util.List;
|
41 |
import java.util.List;
|
42 |
import java.util.Map;
|
42 |
import java.util.Map;
|
43 |
import java.util.Set;
|
43 |
import java.util.Set;
|
44 |
|
44 |
|
45 |
import org.apache.commons.dbutils.ResultSetHandler;
|
45 |
import org.apache.commons.dbutils.ResultSetHandler;
|
46 |
|
46 |
|
47 |
public class InventaireFromEtatStockImporter {
|
47 |
public class InventaireFromEtatStockImporter {
|
48 |
|
48 |
|
49 |
private Map<String, SQLRowValues> kits = new HashMap<String, SQLRowValues>();
|
49 |
private Map<String, SQLRowValues> kits = new HashMap<String, SQLRowValues>();
|
50 |
private List<String> codeKits = new ArrayList<String>();
|
50 |
private List<String> codeKits = new ArrayList<String>();
|
51 |
private SQLRowAccessor depot;
|
51 |
private SQLRowAccessor depot;
|
52 |
|
52 |
|
53 |
public InventaireFromEtatStockImporter(SQLRowAccessor depot) {
|
53 |
public InventaireFromEtatStockImporter(SQLRowAccessor depot) {
|
54 |
this.depot = depot;
|
54 |
this.depot = depot;
|
55 |
}
|
55 |
}
|
56 |
|
56 |
|
57 |
public void importArticles(File file, DBRoot root) throws IOException, SQLException {
|
57 |
public void importArticles(File file, DBRoot root) throws IOException, SQLException {
|
58 |
|
58 |
|
59 |
final SQLTable table = root.findTable("ARTICLE");
|
59 |
final SQLTable table = root.findTable("ARTICLE");
|
60 |
final SQLTable tableArtElt = root.findTable("ARTICLE_ELEMENT");
|
60 |
final SQLTable tableArtElt = root.findTable("ARTICLE_ELEMENT");
|
61 |
|
61 |
|
62 |
Map<String, Tuple2<SQLRowValues, SQLRowValues>> articles = getArticles();
|
62 |
Map<String, Tuple2<SQLRowValues, SQLRowValues>> articles = getArticles();
|
63 |
|
63 |
|
64 |
final DataImporter importer = new DataImporter(table) {
|
64 |
final DataImporter importer = new DataImporter(table) {
|
65 |
@Override
|
65 |
@Override
|
66 |
protected void customizeRowValuesToFetch(SQLRowValues vals) {
|
66 |
protected void customizeRowValuesToFetch(SQLRowValues vals) {
|
67 |
|
67 |
|
68 |
vals.putRowValues("ID_STOCK").putNulls("ID", "QTE_REEL", "QTE_TH", "ID_DEPOT_STOCK");
|
68 |
vals.putRowValues("ID_STOCK").putNulls("ID", "QTE_REEL", "QTE_TH", "ID_DEPOT_STOCK");
|
69 |
}
|
69 |
}
|
70 |
};
|
70 |
};
|
71 |
importer.setSkipFirstLine(true);
|
71 |
importer.setSkipFirstLine(true);
|
72 |
|
72 |
|
73 |
ArrayTableModel m = importer.createModelFrom(file);
|
73 |
ArrayTableModel m = importer.createModelFrom(file);
|
74 |
|
74 |
|
75 |
Calendar c = Calendar.getInstance();
|
75 |
Calendar c = Calendar.getInstance();
|
76 |
// c.set(Calendar.DAY_OF_MONTH, 1);
|
76 |
// c.set(Calendar.DAY_OF_MONTH, 1);
|
77 |
// c.set(Calendar.MONTH, Calendar.JANUARY);
|
77 |
// c.set(Calendar.MONTH, Calendar.JANUARY);
|
78 |
// c.set(Calendar.HOUR_OF_DAY, 0);
|
78 |
// c.set(Calendar.HOUR_OF_DAY, 0);
|
79 |
Date today = c.getTime();
|
79 |
Date today = c.getTime();
|
80 |
|
80 |
|
81 |
// TODO ne pas vider les stocks des kits, recalculer les stocks des kits
|
81 |
// TODO ne pas vider les stocks des kits, recalculer les stocks des kits
|
82 |
|
82 |
|
83 |
SQLRowValues rowVals = new SQLRowValues(table.getTable("ETAT_STOCK"));
|
83 |
SQLRowValues rowVals = new SQLRowValues(table.getTable("ETAT_STOCK"));
|
84 |
rowVals.put("DATE", today);
|
84 |
rowVals.put("DATE", today);
|
85 |
rowVals.put("INVENTAIRE", Boolean.TRUE);
|
85 |
rowVals.put("INVENTAIRE", Boolean.TRUE);
|
86 |
rowVals.put("ID_DEPOT_STOCK", this.depot.getID());
|
86 |
rowVals.put("ID_DEPOT_STOCK", this.depot.getID());
|
87 |
SQLRow rowEtat = rowVals.commit();
|
87 |
SQLRow rowEtat = rowVals.commit();
|
88 |
|
88 |
|
89 |
for (int i = 1; i < m.getRowCount(); i++) {
|
89 |
for (int i = 1; i < m.getRowCount(); i++) {
|
90 |
List<Object> o = m.getLineValuesAt(i);
|
90 |
List<Object> o = m.getLineValuesAt(i);
|
91 |
if (o.size() >= 5) {
|
91 |
if (o.size() >= 5) {
|
92 |
System.err.println(o);
|
92 |
System.err.println(o);
|
93 |
String code = o.get(1).toString();
|
93 |
String code = o.get(1).toString();
|
94 |
if (code.trim().length() > 0) {
|
94 |
if (code.trim().length() > 0) {
|
95 |
|
95 |
|
96 |
final String stringQty = o.get(4).toString();
|
96 |
final String stringQty = o.get(4).toString();
|
97 |
Double qty = stringQty.trim().length() == 0 ? 0 : Double.valueOf(stringQty);
|
97 |
Double qty = stringQty.trim().length() == 0 ? 0 : Double.valueOf(stringQty);
|
98 |
final String stringQtyOld = o.get(3).toString();
|
98 |
final String stringQtyOld = o.get(3).toString();
|
99 |
float qtyOld = stringQtyOld.trim().length() == 0 ? 0 : Float.valueOf(stringQtyOld);
|
99 |
float qtyOld = stringQtyOld.trim().length() == 0 ? 0 : Float.valueOf(stringQtyOld);
|
100 |
|
100 |
|
101 |
Tuple2<SQLRowValues, SQLRowValues> match = articles.get(code);
|
101 |
Tuple2<SQLRowValues, SQLRowValues> match = articles.get(code);
|
102 |
if (match != null) {
|
102 |
if (match != null) {
|
103 |
|
103 |
|
104 |
SQLRowAccessor stockValues = match.get1();
|
104 |
SQLRowAccessor stockValues = match.get1();
|
105 |
|
105 |
|
106 |
final SQLTable tableMvt = table.getTable("MOUVEMENT_STOCK");
|
106 |
final SQLTable tableMvt = table.getTable("MOUVEMENT_STOCK");
|
107 |
SQLRowValues rowValsMvtStockClotureFermeture = new SQLRowValues(tableMvt);
|
107 |
SQLRowValues rowValsMvtStockClotureFermeture = new SQLRowValues(tableMvt);
|
108 |
rowValsMvtStockClotureFermeture.put("QTE", -qtyOld);
|
108 |
rowValsMvtStockClotureFermeture.put("QTE", -qtyOld);
|
109 |
rowValsMvtStockClotureFermeture.put("NOM", "Clôture stock avant inventaire");
|
109 |
rowValsMvtStockClotureFermeture.put("NOM", "Clôture stock avant inventaire");
|
110 |
rowValsMvtStockClotureFermeture.put("ID_ARTICLE", match.get0().getID());
|
110 |
rowValsMvtStockClotureFermeture.put("ID_ARTICLE", match.get0().getID());
|
111 |
rowValsMvtStockClotureFermeture.put("DATE", today);
|
111 |
rowValsMvtStockClotureFermeture.put("DATE", today);
|
112 |
rowValsMvtStockClotureFermeture.put("REEL", Boolean.TRUE);
|
112 |
rowValsMvtStockClotureFermeture.put("REEL", Boolean.TRUE);
|
113 |
rowValsMvtStockClotureFermeture.put("ID_STOCK", stockValues.getID());
|
113 |
rowValsMvtStockClotureFermeture.put("ID_STOCK", stockValues.getID());
|
114 |
|
114 |
|
115 |
BigDecimal prc = getPRC(match.get0(), Math.round(qtyOld), today);
|
115 |
BigDecimal prc = getPRC(match.get0(), Math.round(qtyOld), today);
|
116 |
if (prc == null) {
|
116 |
if (prc == null) {
|
117 |
prc = BigDecimal.ZERO;
|
117 |
prc = BigDecimal.ZERO;
|
118 |
}
|
118 |
}
|
119 |
if (tableMvt.contains("PRICE")) {
|
119 |
if (tableMvt.contains("PRICE")) {
|
120 |
rowValsMvtStockClotureFermeture.put("PRICE", prc);
|
120 |
rowValsMvtStockClotureFermeture.put("PRICE", prc);
|
121 |
}
|
121 |
}
|
122 |
rowValsMvtStockClotureFermeture.put("CLOTURE", Boolean.TRUE);
|
122 |
rowValsMvtStockClotureFermeture.put("CLOTURE", Boolean.TRUE);
|
123 |
rowValsMvtStockClotureFermeture.put("ID_ETAT_STOCK", rowEtat.getID());
|
123 |
rowValsMvtStockClotureFermeture.put("ID_ETAT_STOCK", rowEtat.getID());
|
124 |
rowValsMvtStockClotureFermeture.getGraph().store(StoreMode.COMMIT, false);
|
124 |
rowValsMvtStockClotureFermeture.getGraph().store(StoreMode.COMMIT, false);
|
125 |
|
125 |
|
126 |
SQLRowValues rowValsItem = new SQLRowValues(table.getTable("ETAT_STOCK_ELEMENT"));
|
126 |
SQLRowValues rowValsItem = new SQLRowValues(table.getTable("ETAT_STOCK_ELEMENT"));
|
127 |
rowValsItem.put("ID_ETAT_STOCK", rowEtat.getID());
|
127 |
rowValsItem.put("ID_ETAT_STOCK", rowEtat.getID());
|
128 |
rowValsItem.put("PA", prc);
|
128 |
rowValsItem.put("PA", prc);
|
129 |
rowValsItem.put("PV", BigDecimal.ZERO);
|
129 |
rowValsItem.put("PV", BigDecimal.ZERO);
|
130 |
rowValsItem.put("QTE", qtyOld);
|
130 |
rowValsItem.put("QTE", qtyOld);
|
131 |
rowValsItem.put("T_PA", prc.multiply(new BigDecimal(qtyOld)));
|
131 |
rowValsItem.put("T_PA", prc.multiply(new BigDecimal(qtyOld)));
|
132 |
rowValsItem.put("T_PV", BigDecimal.ZERO);
|
132 |
rowValsItem.put("T_PV", BigDecimal.ZERO);
|
133 |
rowValsItem.put("CODE", match.get0().getString("CODE"));
|
133 |
rowValsItem.put("CODE", match.get0().getString("CODE"));
|
134 |
rowValsItem.put("NOM", match.get0().getString("NOM"));
|
134 |
rowValsItem.put("NOM", match.get0().getString("NOM"));
|
135 |
rowValsItem.put("ID_ARTICLE", match.get0().getID());
|
135 |
rowValsItem.put("ID_ARTICLE", match.get0().getID());
|
136 |
rowValsItem.getGraph().store(StoreMode.COMMIT, false);
|
136 |
rowValsItem.getGraph().store(StoreMode.COMMIT, false);
|
137 |
|
137 |
|
138 |
SQLRowValues rowValsMvtStockClotureOuverture = new SQLRowValues(tableMvt);
|
138 |
SQLRowValues rowValsMvtStockClotureOuverture = new SQLRowValues(tableMvt);
|
139 |
rowValsMvtStockClotureOuverture.put("QTE", qty);
|
139 |
rowValsMvtStockClotureOuverture.put("QTE", qty);
|
140 |
rowValsMvtStockClotureOuverture.put("NOM", "Mise en stock inventaire");
|
140 |
rowValsMvtStockClotureOuverture.put("NOM", "Mise en stock inventaire");
|
141 |
rowValsMvtStockClotureOuverture.put("ID_ETAT_STOCK", rowEtat.getID());
|
141 |
rowValsMvtStockClotureOuverture.put("ID_ETAT_STOCK", rowEtat.getID());
|
142 |
rowValsMvtStockClotureOuverture.put("ID_ARTICLE", match.get0().getID());
|
142 |
rowValsMvtStockClotureOuverture.put("ID_ARTICLE", match.get0().getID());
|
143 |
rowValsMvtStockClotureOuverture.put("DATE", today);
|
143 |
rowValsMvtStockClotureOuverture.put("DATE", today);
|
144 |
rowValsMvtStockClotureOuverture.put("REEL", Boolean.TRUE);
|
144 |
rowValsMvtStockClotureOuverture.put("REEL", Boolean.TRUE);
|
145 |
rowValsMvtStockClotureOuverture.put("ID_STOCK", stockValues.getID());
|
145 |
rowValsMvtStockClotureOuverture.put("ID_STOCK", stockValues.getID());
|
146 |
rowValsMvtStockClotureOuverture.put("OUVERTURE", Boolean.TRUE);
|
146 |
rowValsMvtStockClotureOuverture.put("OUVERTURE", Boolean.TRUE);
|
147 |
if (tableMvt.contains("PRICE")) {
|
147 |
if (tableMvt.contains("PRICE")) {
|
148 |
rowValsMvtStockClotureOuverture.put("PRICE", getPRC(match.get0(), qty.intValue(), today));
|
148 |
rowValsMvtStockClotureOuverture.put("PRICE", getPRC(match.get0(), qty.intValue(), today));
|
149 |
}
|
149 |
}
|
150 |
rowValsMvtStockClotureOuverture.getGraph().store(StoreMode.COMMIT, false);
|
150 |
rowValsMvtStockClotureOuverture.getGraph().store(StoreMode.COMMIT, false);
|
151 |
|
151 |
|
152 |
// if (!match.isForeignEmpty("ID_STOCK")) {
|
152 |
// if (!match.isForeignEmpty("ID_STOCK")) {
|
153 |
// match.getForeign("ID_STOCK").createEmptyUpdateRow().put("QTE_REEL",
|
153 |
// match.getForeign("ID_STOCK").createEmptyUpdateRow().put("QTE_REEL",
|
154 |
// qty).commit();
|
154 |
// qty).commit();
|
155 |
// } else {
|
155 |
// } else {
|
156 |
final SQLRowValues createEmptyUpdateRow = match.get1().createEmptyUpdateRow();
|
156 |
final SQLRowValues createEmptyUpdateRow = match.get1().createEmptyUpdateRow();
|
157 |
createEmptyUpdateRow.put("QTE_REEL", qty);
|
157 |
createEmptyUpdateRow.put("QTE_REEL", qty);
|
158 |
createEmptyUpdateRow.getGraph().store(StoreMode.COMMIT, false);
|
158 |
createEmptyUpdateRow.getGraph().store(StoreMode.COMMIT, false);
|
159 |
|
159 |
|
160 |
// }
|
160 |
// }
|
161 |
|
161 |
|
162 |
} else {
|
162 |
} else {
|
163 |
System.err.println("Aucun article correspondant au code " + code);
|
163 |
System.err.println("Aucun article correspondant au code " + code);
|
164 |
}
|
164 |
}
|
165 |
}
|
165 |
}
|
166 |
}
|
166 |
}
|
167 |
}
|
167 |
}
|
168 |
|
168 |
|
169 |
/**
|
169 |
/**
|
170 |
* Mise à jour des kits
|
170 |
* Mise à jour des kits
|
171 |
*/
|
171 |
*/
|
172 |
|
172 |
|
173 |
List<String> reqs = new ArrayList<String>();
|
173 |
List<String> reqs = new ArrayList<String>();
|
174 |
for (String code : codeKits) {
|
174 |
for (String code : codeKits) {
|
175 |
System.err.println(code);
|
175 |
System.err.println(code);
|
176 |
SQLRowValues rowValsKit = kits.get(code);
|
176 |
SQLRowValues rowValsKit = kits.get(code);
|
177 |
StockItem item = new StockItem(rowValsKit, rowValsKit.getForeign("ID_STOCK"));
|
177 |
StockItem item = new StockItem(rowValsKit, rowValsKit.getForeign("ID_STOCK"));
|
178 |
Collection<SQLRowValues> elts = rowValsKit.getReferentRows(tableArtElt.getField("ID_ARTICLE_PARENT"));
|
178 |
Collection<SQLRowValues> elts = rowValsKit.getReferentRows(tableArtElt.getField("ID_ARTICLE_PARENT"));
|
179 |
for (SQLRowValues sqlRowValues : elts) {
|
179 |
for (SQLRowValues sqlRowValues : elts) {
|
180 |
if (sqlRowValues.getForeign("ID_ARTICLE") != null) {
|
180 |
if (sqlRowValues.getForeign("ID_ARTICLE") != null) {
|
181 |
item.addItemComponent(new StockItemComponent(new StockItem(sqlRowValues.getForeign("ID_ARTICLE"), sqlRowValues.getForeign("ID_ARTICLE").getForeign("ID_STOCK")),
|
181 |
item.addItemComponent(new StockItemComponent(new StockItem(sqlRowValues.getForeign("ID_ARTICLE"), sqlRowValues.getForeign("ID_ARTICLE").getForeign("ID_STOCK")),
|
182 |
sqlRowValues.getBigDecimal("QTE_UNITAIRE"), sqlRowValues.getInt("QTE")));
|
182 |
sqlRowValues.getBigDecimal("QTE_UNITAIRE"), sqlRowValues.getInt("QTE")));
|
183 |
}
|
183 |
}
|
184 |
}
|
184 |
}
|
185 |
item.updateQtyFromChildren();
|
185 |
item.updateQtyFromChildren();
|
186 |
reqs.add(item.getUpdateRequest());
|
186 |
reqs.add(item.getUpdateRequest());
|
187 |
}
|
187 |
}
|
188 |
|
188 |
|
189 |
List<? extends ResultSetHandler> handlers = new ArrayList<ResultSetHandler>(reqs.size());
|
189 |
List<? extends ResultSetHandler> handlers = new ArrayList<ResultSetHandler>(reqs.size());
|
190 |
for (String s : reqs) {
|
190 |
for (String s : reqs) {
|
191 |
handlers.add(null);
|
191 |
handlers.add(null);
|
192 |
}
|
192 |
}
|
193 |
// FIXME FIRE TABLE CHANGED TO UPDATE ILISTE ??
|
193 |
// FIXME FIRE TABLE CHANGED TO UPDATE ILISTE ??
|
194 |
SQLUtils.executeMultiple(table.getDBSystemRoot(), reqs, handlers);
|
194 |
SQLUtils.executeMultiple(table.getDBSystemRoot(), reqs, handlers);
|
195 |
|
195 |
|
196 |
/**
|
196 |
/**
|
197 |
* Mise à jour des prix mini
|
197 |
* Mise à jour des prix mini
|
198 |
*/
|
198 |
*/
|
199 |
// for (SQLRowValues rowValsArt : rowValsArtNonSync) {
|
199 |
// for (SQLRowValues rowValsArt : rowValsArtNonSync) {
|
200 |
// SQLRow rowArt = rowValsArt.asRow();
|
200 |
// SQLRow rowArt = rowValsArt.asRow();
|
201 |
// List<SQLRow> rowsPVMin =
|
201 |
// List<SQLRow> rowsPVMin =
|
202 |
// rowArt.getReferentRows(tableArtElt.getTable("ARTICLE_PRIX_MIN_VENTE"));
|
202 |
// rowArt.getReferentRows(tableArtElt.getTable("ARTICLE_PRIX_MIN_VENTE"));
|
203 |
// List<SQLRow> rowsPA =
|
203 |
// List<SQLRow> rowsPA =
|
204 |
// rowArt.getReferentRows(tableArtElt.getTable("ARTICLE_TARIF_FOURNISSEUR"));
|
204 |
// rowArt.getReferentRows(tableArtElt.getTable("ARTICLE_TARIF_FOURNISSEUR"));
|
205 |
//
|
205 |
//
|
206 |
// // On récupére les derniers prix min valides
|
206 |
// // On récupére les derniers prix min valides
|
207 |
// Map<Integer, SQLRow> mapLastValidRows = new HashMap<Integer, SQLRow>();
|
207 |
// Map<Integer, SQLRow> mapLastValidRows = new HashMap<Integer, SQLRow>();
|
208 |
// for (SQLRow rowPVMin : rowsPVMin) {
|
208 |
// for (SQLRow rowPVMin : rowsPVMin) {
|
209 |
// final int qteMinPrice = rowPVMin.getInt("QTE");
|
209 |
// final int qteMinPrice = rowPVMin.getInt("QTE");
|
210 |
// SQLRow rowValsLastValid = mapLastValidRows.get(qteMinPrice);
|
210 |
// SQLRow rowValsLastValid = mapLastValidRows.get(qteMinPrice);
|
211 |
// if (rowValsLastValid == null || rowValsLastValid.getDate("DATE") == null ||
|
211 |
// if (rowValsLastValid == null || rowValsLastValid.getDate("DATE") == null ||
|
212 |
// rowValsLastValid.getDate("DATE").before(rowPVMin.getDate("DATE"))) {
|
212 |
// rowValsLastValid.getDate("DATE").before(rowPVMin.getDate("DATE"))) {
|
213 |
// mapLastValidRows.put(qteMinPrice, rowPVMin);
|
213 |
// mapLastValidRows.put(qteMinPrice, rowPVMin);
|
214 |
// }
|
214 |
// }
|
215 |
// }
|
215 |
// }
|
216 |
//
|
216 |
//
|
217 |
// // On récupére les derniers Prix d'achat valide
|
217 |
// // On récupére les derniers Prix d'achat valide
|
218 |
// Map<Integer, SQLRow> mapLastValidAchatRows = new HashMap<Integer, SQLRow>();
|
218 |
// Map<Integer, SQLRow> mapLastValidAchatRows = new HashMap<Integer, SQLRow>();
|
219 |
// for (SQLRow rowPA : rowsPA) {
|
219 |
// for (SQLRow rowPA : rowsPA) {
|
220 |
// final int qtePRC = rowPA.getInt("QTE");
|
220 |
// final int qtePRC = rowPA.getInt("QTE");
|
221 |
// SQLRow rowValsLastValid = mapLastValidAchatRows.get(qtePRC);
|
221 |
// SQLRow rowValsLastValid = mapLastValidAchatRows.get(qtePRC);
|
222 |
// if (rowValsLastValid == null || rowValsLastValid.getDate("DATE_PRIX") == null ||
|
222 |
// if (rowValsLastValid == null || rowValsLastValid.getDate("DATE_PRIX") == null ||
|
223 |
// rowValsLastValid.getDate("DATE_PRIX").before(rowPA.getDate("DATE_PRIX"))) {
|
223 |
// rowValsLastValid.getDate("DATE_PRIX").before(rowPA.getDate("DATE_PRIX"))) {
|
224 |
// mapLastValidAchatRows.put(qtePRC, rowPA);
|
224 |
// mapLastValidAchatRows.put(qtePRC, rowPA);
|
225 |
// }
|
225 |
// }
|
226 |
// }
|
226 |
// }
|
227 |
//
|
227 |
//
|
228 |
// // Mise à jour, si Prix < au prix min, du PRC et des prix min
|
228 |
// // Mise à jour, si Prix < au prix min, du PRC et des prix min
|
229 |
// for (Integer qte : mapLastValidAchatRows.keySet()) {
|
229 |
// for (Integer qte : mapLastValidAchatRows.keySet()) {
|
230 |
// SQLRow rowVals = mapLastValidAchatRows.get(qte);
|
230 |
// SQLRow rowVals = mapLastValidAchatRows.get(qte);
|
231 |
// checkMinPrice(rowVals, mapLastValidRows.get(qte));
|
231 |
// checkMinPrice(rowVals, mapLastValidRows.get(qte));
|
232 |
// }
|
232 |
// }
|
233 |
// }
|
233 |
// }
|
234 |
|
234 |
|
235 |
}
|
235 |
}
|
236 |
|
236 |
|
237 |
private void checkMinPrice(SQLRow rowValsSuplierLastValid, SQLRow lastValidRow) {
|
237 |
private void checkMinPrice(SQLRow rowValsSuplierLastValid, SQLRow lastValidRow) {
|
238 |
boolean update = false;
|
238 |
boolean update = false;
|
239 |
final ProductHelper helper = new ProductHelper(rowValsSuplierLastValid.getTable().getDBRoot());
|
239 |
final ProductHelper helper = new ProductHelper(rowValsSuplierLastValid.getTable().getDBRoot());
|
240 |
|
240 |
|
241 |
BigDecimal result = helper.getEnumPrice(rowValsSuplierLastValid, SupplierPriceField.COEF_PRIX_MINI);
|
241 |
BigDecimal result = helper.getEnumPrice(rowValsSuplierLastValid, SupplierPriceField.COEF_PRIX_MINI);
|
242 |
if (result != null) {
|
242 |
if (result != null) {
|
243 |
final int qteSuplier = rowValsSuplierLastValid.getInt("QTE");
|
243 |
final int qteSuplier = rowValsSuplierLastValid.getInt("QTE");
|
244 |
|
244 |
|
245 |
final Calendar date2 = rowValsSuplierLastValid.getDate("DATE_PRIX");
|
245 |
final Calendar date2 = rowValsSuplierLastValid.getDate("DATE_PRIX");
|
246 |
if (date2 != null) {
|
246 |
if (date2 != null) {
|
247 |
if (lastValidRow != null) {
|
247 |
if (lastValidRow != null) {
|
248 |
final Calendar date1 = lastValidRow.getDate("DATE");
|
248 |
final Calendar date1 = lastValidRow.getDate("DATE");
|
249 |
if ((date1.get(Calendar.YEAR) == date2.get(Calendar.YEAR) && date1.get(Calendar.MONTH) == date2.get(Calendar.MONTH)
|
249 |
if ((date1.get(Calendar.YEAR) == date2.get(Calendar.YEAR) && date1.get(Calendar.MONTH) == date2.get(Calendar.MONTH)
|
250 |
&& date1.get(Calendar.DAY_OF_MONTH) == date2.get(Calendar.DAY_OF_MONTH)) || date1.after(date2)) {
|
250 |
&& date1.get(Calendar.DAY_OF_MONTH) == date2.get(Calendar.DAY_OF_MONTH)) || date1.after(date2)) {
|
251 |
if (lastValidRow.getBigDecimal("PRIX") != null && lastValidRow.getInt("QTE") <= qteSuplier) {
|
251 |
if (lastValidRow.getBigDecimal("PRIX") != null && lastValidRow.getInt("QTE") <= qteSuplier) {
|
252 |
try {
|
252 |
try {
|
253 |
lastValidRow.asRowValues().put("PRIX", result).commit();
|
253 |
lastValidRow.asRowValues().put("PRIX", result).commit();
|
254 |
} catch (SQLException e) {
|
254 |
} catch (SQLException e) {
|
255 |
// TODO Auto-generated catch block
|
255 |
// TODO Auto-generated catch block
|
256 |
e.printStackTrace();
|
256 |
e.printStackTrace();
|
257 |
}
|
257 |
}
|
258 |
// purchaseMinPriceListTable.setPriceMin(result);
|
258 |
// purchaseMinPriceListTable.setPriceMin(result);
|
259 |
update = true;
|
259 |
update = true;
|
260 |
}
|
260 |
}
|
261 |
} else {
|
261 |
} else {
|
262 |
if (date1.before(date2)) {
|
262 |
if (date1.before(date2)) {
|
263 |
SQLRowValues rowValsToInsert = new SQLRowValues(lastValidRow.getTable());
|
263 |
SQLRowValues rowValsToInsert = new SQLRowValues(lastValidRow.getTable());
|
264 |
rowValsToInsert.put("PRIX", result);
|
264 |
rowValsToInsert.put("PRIX", result);
|
265 |
rowValsToInsert.put("DATE", rowValsSuplierLastValid.getObject("DATE_PRIX"));
|
265 |
rowValsToInsert.put("DATE", rowValsSuplierLastValid.getObject("DATE_PRIX"));
|
266 |
rowValsToInsert.put("QTE", rowValsSuplierLastValid.getObject("QTE"));
|
266 |
rowValsToInsert.put("QTE", rowValsSuplierLastValid.getObject("QTE"));
|
267 |
rowValsToInsert.put("ID_ARTICLE", rowValsSuplierLastValid.getInt("ID_ARTICLE"));
|
267 |
rowValsToInsert.put("ID_ARTICLE", rowValsSuplierLastValid.getInt("ID_ARTICLE"));
|
268 |
try {
|
268 |
try {
|
269 |
rowValsToInsert.commit();
|
269 |
rowValsToInsert.commit();
|
270 |
} catch (SQLException e) {
|
270 |
} catch (SQLException e) {
|
271 |
// TODO Auto-generated catch block
|
271 |
// TODO Auto-generated catch block
|
272 |
e.printStackTrace();
|
272 |
e.printStackTrace();
|
273 |
}
|
273 |
}
|
274 |
}
|
274 |
}
|
275 |
}
|
275 |
}
|
276 |
}
|
276 |
}
|
277 |
}
|
277 |
}
|
278 |
}
|
278 |
}
|
279 |
|
279 |
|
280 |
}
|
280 |
}
|
281 |
|
281 |
|
282 |
public BigDecimal getPRC(SQLRowValues rowVals, int qty, Date d) {
|
282 |
public BigDecimal getPRC(SQLRowValues rowVals, int qty, Date d) {
|
283 |
// SQLTable table = rowVals.getTable().getDBRoot().getTable("ARTICLE_PRIX_REVIENT");
|
283 |
// SQLTable table = rowVals.getTable().getDBRoot().getTable("ARTICLE_PRIX_REVIENT");
|
284 |
// Collection<SQLRow> prcs = rowVals.asRow().getReferentRows(table);
|
284 |
// Collection<SQLRow> prcs = rowVals.asRow().getReferentRows(table);
|
285 |
//
|
285 |
//
|
286 |
// BigDecimal result = null;
|
286 |
// BigDecimal result = null;
|
287 |
// final List<PriceByQty> prices = new ArrayList<PriceByQty>();
|
287 |
// final List<PriceByQty> prices = new ArrayList<PriceByQty>();
|
288 |
//
|
288 |
//
|
289 |
// for (SQLRow row : prcs) {
|
289 |
// for (SQLRow row : prcs) {
|
290 |
// Calendar date = Calendar.getInstance();
|
290 |
// Calendar date = Calendar.getInstance();
|
291 |
// date.set(Calendar.DAY_OF_MONTH, 1);
|
291 |
// date.set(Calendar.DAY_OF_MONTH, 1);
|
292 |
// date.set(Calendar.MONTH, 1);
|
292 |
// date.set(Calendar.MONTH, 1);
|
293 |
// date.set(Calendar.YEAR, 2001);
|
293 |
// date.set(Calendar.YEAR, 2001);
|
294 |
// if (row.getObject("DATE") != null) {
|
294 |
// if (row.getObject("DATE") != null) {
|
295 |
// date = row.getDate("DATE");
|
295 |
// date = row.getDate("DATE");
|
296 |
// }
|
296 |
// }
|
297 |
// prices.add(new PriceByQty(row.getLong("QTE"), row.getBigDecimal("PRIX"),
|
297 |
// prices.add(new PriceByQty(row.getLong("QTE"), row.getBigDecimal("PRIX"),
|
298 |
// date.getTime()));
|
298 |
// date.getTime()));
|
299 |
// }
|
299 |
// }
|
300 |
//
|
300 |
//
|
301 |
// result = PriceByQty.getPriceForQty(qty, prices, d);
|
301 |
// result = PriceByQty.getPriceForQty(qty, prices, d);
|
302 |
// if (result == null) {
|
302 |
// if (result == null) {
|
303 |
// // Can occur during editing
|
303 |
// // Can occur during editing
|
304 |
// result = BigDecimal.ZERO;
|
304 |
// result = BigDecimal.ZERO;
|
305 |
// }
|
305 |
// }
|
306 |
|
306 |
|
307 |
ProductComponent comp = new ProductComponent(rowVals, new BigDecimal(qty), null, null);
|
307 |
ProductComponent comp = new ProductComponent(rowVals, new BigDecimal(qty), null, null);
|
308 |
return comp.getPRC(d);
|
308 |
return comp.getPRC(d);
|
309 |
// return result;
|
309 |
// return result;
|
310 |
}
|
310 |
}
|
311 |
|
311 |
|
312 |
private Map<String, Tuple2<SQLRowValues, SQLRowValues>> getArticles() throws SQLException {
|
312 |
private Map<String, Tuple2<SQLRowValues, SQLRowValues>> getArticles() throws SQLException {
|
313 |
final SQLTable table = Configuration.getInstance().getRoot().findTable("ARTICLE");
|
313 |
final SQLTable table = Configuration.getInstance().getRoot().findTable("ARTICLE");
|
314 |
SQLRowValues graph = new SQLRowValues(table);
|
314 |
SQLRowValues graph = new SQLRowValues(table);
|
315 |
graph.put("ID", null);
|
315 |
graph.put("ID", null);
|
316 |
graph.put("CODE", null);
|
316 |
graph.put("CODE", null);
|
317 |
graph.put("NOM", null);
|
317 |
graph.put("NOM", null);
|
318 |
graph.put("NOM", null);
|
318 |
graph.put("NOM", null);
|
319 |
final SQLTable foreignTableStock = table.getForeignTable("ID_STOCK");
|
319 |
final SQLTable foreignTableStock = table.getForeignTable("ID_STOCK");
|
320 |
SQLRowValues graphStock = new SQLRowValues(foreignTableStock);
|
320 |
SQLRowValues graphStock = new SQLRowValues(foreignTableStock);
|
321 |
graphStock.putNulls("ID_DEPOT_STOCK", "ID", "QTE_REEL", "QTE_TH", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE");
|
321 |
graphStock.putNulls("ID_DEPOT_STOCK", "ID", "QTE_REEL", "QTE_TH", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE");
|
322 |
graphStock.put("ID_ARTICLE", graph);
|
322 |
graphStock.put("ID_ARTICLE", graph);
|
323 |
|
323 |
|
324 |
final SQLTable tableArtElt = table.getTable("ARTICLE_ELEMENT");
|
324 |
final SQLTable tableArtElt = table.getTable("ARTICLE_ELEMENT");
|
325 |
SQLRowValues artElt = new SQLRowValues(tableArtElt);
|
325 |
SQLRowValues artElt = new SQLRowValues(tableArtElt);
|
326 |
artElt.put("ID", null);
|
326 |
artElt.put("ID", null);
|
327 |
artElt.put("QTE", null);
|
327 |
artElt.put("QTE", null);
|
328 |
artElt.put("QTE_UNITAIRE", null);
|
328 |
artElt.put("QTE_UNITAIRE", null);
|
329 |
artElt.put("ID_ARTICLE_PARENT", graph);
|
329 |
artElt.put("ID_ARTICLE_PARENT", graph);
|
330 |
final SQLRowValues articleParent = artElt.putRowValues("ID_ARTICLE");
|
330 |
final SQLRowValues articleParent = artElt.putRowValues("ID_ARTICLE");
|
331 |
articleParent.putNulls("ID", "CODE", "NOM");
|
331 |
articleParent.putNulls("ID", "CODE", "NOM");
|
332 |
SQLRowValues graphStockItem = new SQLRowValues(foreignTableStock);
|
332 |
SQLRowValues graphStockItem = new SQLRowValues(foreignTableStock);
|
333 |
graphStockItem.putNulls("ID_DEPOT_STOCK", "ID", "QTE_REEL", "QTE_TH", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE");
|
333 |
graphStockItem.putNulls("ID_DEPOT_STOCK", "ID", "QTE_REEL", "QTE_TH", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE");
|
334 |
graphStockItem.put("ID_ARTICLE", articleParent);
|
334 |
graphStockItem.put("ID_ARTICLE", articleParent);
|
335 |
|
335 |
|
336 |
SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(graph);
|
336 |
SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(graph);
|
337 |
List<SQLRowValues> results = fetcher.fetch();
|
337 |
List<SQLRowValues> results = fetcher.fetch();
|
338 |
|
338 |
|
339 |
Calendar c = Calendar.getInstance();
|
339 |
Calendar c = Calendar.getInstance();
|
340 |
// c.set(Calendar.DAY_OF_MONTH, 1);
|
340 |
// c.set(Calendar.DAY_OF_MONTH, 1);
|
341 |
c.add(Calendar.MONTH, -2);
|
341 |
c.add(Calendar.MONTH, -2);
|
342 |
c.set(Calendar.DAY_OF_MONTH, 31);
|
342 |
c.set(Calendar.DAY_OF_MONTH, 31);
|
343 |
Date dEndYear = c.getTime();
|
343 |
Date dEndYear = c.getTime();
|
344 |
|
344 |
|
345 |
Map<String, Tuple2<SQLRowValues, SQLRowValues>> vals = new HashMap<String, Tuple2<SQLRowValues, SQLRowValues>>();
|
345 |
Map<String, Tuple2<SQLRowValues, SQLRowValues>> vals = new HashMap<String, Tuple2<SQLRowValues, SQLRowValues>>();
|
346 |
for (SQLRowValues sqlRowValues : results) {
|
346 |
for (SQLRowValues sqlRowValues : results) {
|
347 |
final String code = sqlRowValues.getString("CODE");
|
347 |
final String code = sqlRowValues.getString("CODE");
|
348 |
|
348 |
|
349 |
Collection<SQLRowValues> stocks = sqlRowValues.getReferentRows(foreignTableStock);
|
349 |
Collection<SQLRowValues> stocks = sqlRowValues.getReferentRows(foreignTableStock);
|
350 |
|
350 |
|
351 |
SQLRowValues rowValsStock = null;
|
351 |
SQLRowValues rowValsStock = null;
|
352 |
for (SQLRowValues sqlRowValues2 : stocks) {
|
352 |
for (SQLRowValues sqlRowValues2 : stocks) {
|
353 |
if (sqlRowValues2.getForeignID("ID_DEPOT_STOCK") == depot.getID()) {
|
353 |
if (sqlRowValues2.getForeignID("ID_DEPOT_STOCK") == depot.getID()) {
|
354 |
rowValsStock = sqlRowValues2;
|
354 |
rowValsStock = sqlRowValues2;
|
355 |
}
|
355 |
}
|
356 |
}
|
356 |
}
|
357 |
if (rowValsStock == null) {
|
357 |
if (rowValsStock == null) {
|
358 |
rowValsStock = ProductComponent.findOrCreateStock(sqlRowValues, depot).asRowValues();
|
358 |
rowValsStock = ProductComponent.findOrCreateStock(sqlRowValues, depot).asRowValues();
|
359 |
}
|
359 |
}
|
360 |
|
360 |
|
361 |
vals.put(code, Tuple2.create(sqlRowValues, rowValsStock));
|
361 |
vals.put(code, Tuple2.create(sqlRowValues, rowValsStock));
|
362 |
|
362 |
|
363 |
final Set<SQLRowValues> referentRows = sqlRowValues.getReferentRows(tableArtElt.getField("ID_ARTICLE_PARENT"));
|
363 |
final Set<SQLRowValues> referentRows = sqlRowValues.getReferentRows(tableArtElt.getField("ID_ARTICLE_PARENT"));
|
364 |
if (referentRows.size() == 0) {
|
364 |
if (referentRows.size() == 0) {
|
365 |
// if (!sqlRowValues.isForeignEmpty("ID_STOCK")) {
|
365 |
// if (!sqlRowValues.isForeignEmpty("ID_STOCK")) {
|
366 |
// SQLRowAccessor rowValsStock = sqlRowValues.getForeign("ID_STOCK");
|
366 |
// SQLRowAccessor rowValsStock = sqlRowValues.getForeign("ID_STOCK");
|
367 |
// int qteReel = rowValsStock.getInt("QTE_REEL");
|
367 |
// int qteReel = rowValsStock.getInt("QTE_REEL");
|
368 |
// {
|
368 |
// {
|
369 |
// SQLRowValues rowValsMvtStockCloture = new
|
369 |
// SQLRowValues rowValsMvtStockCloture = new
|
370 |
// SQLRowValues(table.getTable("MOUVEMENT_STOCK"));
|
370 |
// SQLRowValues(table.getTable("MOUVEMENT_STOCK"));
|
371 |
// rowValsMvtStockCloture.put("QTE", -qteReel);
|
371 |
// rowValsMvtStockCloture.put("QTE", -qteReel);
|
372 |
// rowValsMvtStockCloture.put("NOM", "Clôture du stock avant inventaire");
|
372 |
// rowValsMvtStockCloture.put("NOM", "Clôture du stock avant inventaire");
|
373 |
// rowValsMvtStockCloture.put("ID_ARTICLE", sqlRowValues.getID());
|
373 |
// rowValsMvtStockCloture.put("ID_ARTICLE", sqlRowValues.getID());
|
374 |
// rowValsMvtStockCloture.put("DATE", dEndYear);
|
374 |
// rowValsMvtStockCloture.put("DATE", dEndYear);
|
375 |
// rowValsMvtStockCloture.put("REEL", Boolean.TRUE);
|
375 |
// rowValsMvtStockCloture.put("REEL", Boolean.TRUE);
|
376 |
// rowValsMvtStockCloture.put("PRICE", getPRC(sqlRowValues, qteReel, dEndYear));
|
376 |
// rowValsMvtStockCloture.put("PRICE", getPRC(sqlRowValues, qteReel, dEndYear));
|
377 |
// rowValsMvtStockCloture.commit();
|
377 |
// rowValsMvtStockCloture.commit();
|
378 |
//
|
378 |
//
|
379 |
// rowValsStock.createEmptyUpdateRow().put("QTE_REEL", 0).commit();
|
379 |
// rowValsStock.createEmptyUpdateRow().put("QTE_REEL", 0).commit();
|
380 |
// }
|
380 |
// }
|
381 |
//
|
381 |
//
|
382 |
// } else {
|
382 |
// } else {
|
383 |
// sqlRowValues.putRowValues("ID_STOCK").commit();
|
383 |
// sqlRowValues.putRowValues("ID_STOCK").commit();
|
384 |
// }
|
384 |
// }
|
385 |
} else {
|
385 |
} else {
|
386 |
boolean contains = false;
|
386 |
boolean contains = false;
|
387 |
for (SQLRowValues sqlRowValues2 : referentRows) {
|
387 |
for (SQLRowValues sqlRowValues2 : referentRows) {
|
388 |
if (!sqlRowValues2.isForeignEmpty("ID_ARTICLE") && sqlRowValues2.getForeign("ID_ARTICLE") != null && sqlRowValues2.getForeign("ID_ARTICLE").getString("CODE") != null) {
|
388 |
if (sqlRowValues2.getForeign("ID_ARTICLE") != null && !sqlRowValues2.isForeignEmpty("ID_ARTICLE") && sqlRowValues2.getForeign("ID_ARTICLE").getString("CODE") != null) {
|
389 |
if (codeKits.contains(sqlRowValues2.getForeign("ID_ARTICLE").getString("CODE"))) {
|
389 |
if (codeKits.contains(sqlRowValues2.getForeign("ID_ARTICLE").getString("CODE"))) {
|
390 |
contains = true;
|
390 |
contains = true;
|
391 |
break;
|
391 |
break;
|
392 |
}
|
392 |
}
|
393 |
}
|
393 |
}
|
394 |
}
|
394 |
}
|
395 |
if (!contains) {
|
395 |
if (!contains) {
|
396 |
codeKits.add(0, code);
|
396 |
codeKits.add(0, code);
|
397 |
} else {
|
397 |
} else {
|
398 |
codeKits.add(code);
|
398 |
codeKits.add(code);
|
399 |
}
|
399 |
}
|
400 |
kits.put(code, sqlRowValues);
|
400 |
kits.put(code, sqlRowValues);
|
401 |
// if (sqlRowValues.isForeignEmpty("ID_STOCK")) {
|
401 |
// if (sqlRowValues.isForeignEmpty("ID_STOCK")) {
|
402 |
// sqlRowValues.putRowValues("ID_STOCK").commit();
|
402 |
// sqlRowValues.putRowValues("ID_STOCK").commit();
|
403 |
// }
|
403 |
// }
|
404 |
}
|
404 |
}
|
405 |
}
|
405 |
}
|
406 |
return vals;
|
406 |
return vals;
|
407 |
}
|
407 |
}
|
408 |
}
|
408 |
}
|