Line 57... |
Line 57... |
57 |
import java.math.RoundingMode;
|
57 |
import java.math.RoundingMode;
|
58 |
import java.sql.SQLException;
|
58 |
import java.sql.SQLException;
|
59 |
import java.text.SimpleDateFormat;
|
59 |
import java.text.SimpleDateFormat;
|
60 |
import java.util.ArrayList;
|
60 |
import java.util.ArrayList;
|
61 |
import java.util.Collection;
|
61 |
import java.util.Collection;
|
- |
|
62 |
import java.util.Collections;
|
- |
|
63 |
import java.util.Comparator;
|
62 |
import java.util.Date;
|
64 |
import java.util.Date;
|
63 |
import java.util.List;
|
65 |
import java.util.List;
|
64 |
import java.util.Map.Entry;
|
66 |
import java.util.Map.Entry;
|
65 |
|
67 |
|
66 |
import javax.swing.JOptionPane;
|
68 |
import javax.swing.JOptionPane;
|
Line 333... |
Line 335... |
333 |
}
|
335 |
}
|
334 |
|
336 |
|
335 |
CommandeItemTable itemTable = cmp.getRowValuesTablePanel();
|
337 |
CommandeItemTable itemTable = cmp.getRowValuesTablePanel();
|
336 |
|
338 |
|
337 |
final RowValuesTableModel model = cmp.getRowValuesTable().getRowValuesTableModel();
|
339 |
final RowValuesTableModel model = cmp.getRowValuesTable().getRowValuesTableModel();
|
- |
|
340 |
final List<SQLRowValues> articleToCmd = e.getValue();
|
- |
|
341 |
// Tri des items par code, couleur et taille
|
- |
|
342 |
Collections.sort(articleToCmd, new Comparator<SQLRowValues>() {
|
- |
|
343 |
@Override
|
- |
|
344 |
public int compare(SQLRowValues o1, SQLRowValues o2) {
|
- |
|
345 |
SQLRowAccessor o1ArticleNumber = o1.contains("ID_ARTICLE") ? o1.getNonEmptyForeign("ID_ARTICLE") : null;
|
- |
|
346 |
SQLRowAccessor o2ArticleNumber = o1.contains("ID_ARTICLE") ? o1.getNonEmptyForeign("ID_ARTICLE") : null;
|
- |
|
347 |
if (o1ArticleNumber != null && o2ArticleNumber != null) {
|
- |
|
348 |
int comparedCode = o1ArticleNumber.getString("CODE").compareTo(o1ArticleNumber.getString("CODE"));
|
- |
|
349 |
if (comparedCode == 0) {
|
- |
|
350 |
SQLRowAccessor o1CouleurNumber = o1ArticleNumber.contains("ID_ARTICLE_DECLINAISON_COULEUR")
|
- |
|
351 |
? o1ArticleNumber.getNonEmptyForeign("ID_ARTICLE_DECLINAISON_COULEUR")
|
- |
|
352 |
: null;
|
- |
|
353 |
SQLRowAccessor o2CouleurNumber = o2ArticleNumber.contains("ID_ARTICLE_DECLINAISON_COULEUR")
|
- |
|
354 |
? o2ArticleNumber.getNonEmptyForeign("ID_ARTICLE_DECLINAISON_COULEUR")
|
- |
|
355 |
: null;
|
- |
|
356 |
if (o1CouleurNumber != null && o2CouleurNumber != null) {
|
- |
|
357 |
int comparedCouleurCode = o1CouleurNumber.getBigDecimal("ORDRE").compareTo(o2CouleurNumber.getBigDecimal("ORDRE"));
|
- |
|
358 |
if (comparedCouleurCode != 0) {
|
- |
|
359 |
return comparedCouleurCode;
|
- |
|
360 |
}
|
- |
|
361 |
}
|
- |
|
362 |
SQLRowAccessor o1TailleNumber = o1ArticleNumber.contains("ID_ARTICLE_TAILLE_COULEUR") ? o1ArticleNumber.getNonEmptyForeign("ID_ARTICLE_TAILLE_COULEUR") : null;
|
- |
|
363 |
SQLRowAccessor o2TailleNumber = o2ArticleNumber.contains("ID_ARTICLE_TAILLE_COULEUR") ? o2ArticleNumber.getNonEmptyForeign("ID_ARTICLE_TAILLE_COULEUR") : null;
|
- |
|
364 |
if (o1TailleNumber != null && o2TailleNumber != null) {
|
- |
|
365 |
int comparedTailleCode = o1TailleNumber.getBigDecimal("ORDRE").compareTo(o2TailleNumber.getBigDecimal("ORDRE"));
|
- |
|
366 |
return comparedTailleCode;
|
- |
|
367 |
}
|
- |
|
368 |
}
|
- |
|
369 |
return comparedCode;
|
- |
|
370 |
} else {
|
- |
|
371 |
return o1.getString("CODE").compareTo(o2.getString("CODE"));
|
- |
|
372 |
}
|
- |
|
373 |
}
|
- |
|
374 |
});
|
338 |
for (SQLRowValues rowValsElt : e.getValue()) {
|
375 |
for (SQLRowValues rowValsElt : articleToCmd) {
|
339 |
SQLRowValues rowValsMatch = null;
|
376 |
SQLRowValues rowValsMatch = null;
|
340 |
int index = 0;
|
377 |
int index = 0;
|
341 |
|
- |
|
342 |
for (int i = 0; i < model.getRowCount(); i++) {
|
378 |
for (int i = 0; i < model.getRowCount(); i++) {
|
343 |
final SQLRowValues rowValsCmdElt = model.getRowValuesAt(i);
|
379 |
final SQLRowValues rowValsCmdElt = model.getRowValuesAt(i);
|
344 |
Number lineArticleNumber = rowValsCmdElt.contains("ID_ARTICLE") ? rowValsCmdElt.getNonEmptyForeignIDNumber("ID_ARTICLE") : null;
|
380 |
Number lineArticleNumber = rowValsCmdElt.contains("ID_ARTICLE") ? rowValsCmdElt.getNonEmptyForeignIDNumber("ID_ARTICLE") : null;
|
345 |
Number lineToAddArticleNumber = rowValsElt.contains("ID_ARTICLE") ? rowValsElt.getNonEmptyForeignIDNumber("ID_ARTICLE") : null;
|
381 |
Number lineToAddArticleNumber = rowValsElt.contains("ID_ARTICLE") ? rowValsElt.getNonEmptyForeignIDNumber("ID_ARTICLE") : null;
|
346 |
if (lineToAddArticleNumber == null || lineArticleNumber == null || lineArticleNumber.equals(lineToAddArticleNumber)) {
|
382 |
if (lineToAddArticleNumber == null || lineArticleNumber == null || lineArticleNumber.equals(lineToAddArticleNumber)) {
|