Line 29... |
Line 29... |
29 |
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater.TypeStockUpdate;
|
29 |
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater.TypeStockUpdate;
|
30 |
import org.openconcerto.erp.core.supplychain.stock.element.StockLabel;
|
30 |
import org.openconcerto.erp.core.supplychain.stock.element.StockLabel;
|
31 |
import org.openconcerto.erp.generationDoc.gestcomm.CommandeXmlSheet;
|
31 |
import org.openconcerto.erp.generationDoc.gestcomm.CommandeXmlSheet;
|
32 |
import org.openconcerto.erp.panel.PanelOOSQLComponent;
|
32 |
import org.openconcerto.erp.panel.PanelOOSQLComponent;
|
33 |
import org.openconcerto.erp.preferences.DefaultNXProps;
|
33 |
import org.openconcerto.erp.preferences.DefaultNXProps;
|
- |
|
34 |
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel;
|
34 |
import org.openconcerto.erp.utils.TM;
|
35 |
import org.openconcerto.erp.utils.TM;
|
35 |
import org.openconcerto.sql.Configuration;
|
36 |
import org.openconcerto.sql.Configuration;
|
36 |
import org.openconcerto.sql.element.DefaultElementSQLObject;
|
37 |
import org.openconcerto.sql.element.DefaultElementSQLObject;
|
37 |
import org.openconcerto.sql.element.ElementSQLObject;
|
38 |
import org.openconcerto.sql.element.ElementSQLObject;
|
38 |
import org.openconcerto.sql.element.SQLElement;
|
39 |
import org.openconcerto.sql.element.SQLElement;
|
Line 45... |
Line 46... |
45 |
import org.openconcerto.sql.model.Where;
|
46 |
import org.openconcerto.sql.model.Where;
|
46 |
import org.openconcerto.sql.preferences.SQLPreferences;
|
47 |
import org.openconcerto.sql.preferences.SQLPreferences;
|
47 |
import org.openconcerto.sql.sqlobject.ElementComboBox;
|
48 |
import org.openconcerto.sql.sqlobject.ElementComboBox;
|
48 |
import org.openconcerto.sql.sqlobject.JUniqueTextField;
|
49 |
import org.openconcerto.sql.sqlobject.JUniqueTextField;
|
49 |
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
|
50 |
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
|
- |
|
51 |
import org.openconcerto.sql.sqlobject.SQLTextCombo;
|
50 |
import org.openconcerto.sql.users.UserManager;
|
52 |
import org.openconcerto.sql.users.UserManager;
|
51 |
import org.openconcerto.sql.view.EditFrame;
|
53 |
import org.openconcerto.sql.view.EditFrame;
|
52 |
import org.openconcerto.sql.view.list.RowValuesTable;
|
54 |
import org.openconcerto.sql.view.list.RowValuesTable;
|
- |
|
55 |
import org.openconcerto.sql.view.list.RowValuesTableModel;
|
53 |
import org.openconcerto.ui.AutoHideListener;
|
56 |
import org.openconcerto.ui.AutoHideListener;
|
54 |
import org.openconcerto.ui.DefaultGridBagConstraints;
|
57 |
import org.openconcerto.ui.DefaultGridBagConstraints;
|
55 |
import org.openconcerto.ui.FormLayouter;
|
58 |
import org.openconcerto.ui.FormLayouter;
|
56 |
import org.openconcerto.ui.JDate;
|
59 |
import org.openconcerto.ui.JDate;
|
57 |
import org.openconcerto.ui.TitledSeparator;
|
60 |
import org.openconcerto.ui.TitledSeparator;
|
Line 59... |
Line 62... |
59 |
import org.openconcerto.ui.component.ITextArea;
|
62 |
import org.openconcerto.ui.component.ITextArea;
|
60 |
import org.openconcerto.ui.component.ITextCombo;
|
63 |
import org.openconcerto.ui.component.ITextCombo;
|
61 |
import org.openconcerto.ui.component.InteractionMode;
|
64 |
import org.openconcerto.ui.component.InteractionMode;
|
62 |
import org.openconcerto.ui.preferences.DefaultProps;
|
65 |
import org.openconcerto.ui.preferences.DefaultProps;
|
63 |
import org.openconcerto.utils.ExceptionHandler;
|
66 |
import org.openconcerto.utils.ExceptionHandler;
|
- |
|
67 |
import org.openconcerto.utils.checks.ValidState;
|
64 |
|
68 |
|
65 |
import java.awt.Color;
|
69 |
import java.awt.Color;
|
66 |
import java.awt.GridBagConstraints;
|
70 |
import java.awt.GridBagConstraints;
|
67 |
import java.awt.GridBagLayout;
|
71 |
import java.awt.GridBagLayout;
|
68 |
import java.awt.event.ActionEvent;
|
72 |
import java.awt.event.ActionEvent;
|
69 |
import java.awt.event.ActionListener;
|
73 |
import java.awt.event.ActionListener;
|
70 |
import java.beans.PropertyChangeEvent;
|
74 |
import java.beans.PropertyChangeEvent;
|
71 |
import java.beans.PropertyChangeListener;
|
75 |
import java.beans.PropertyChangeListener;
|
72 |
import java.sql.SQLException;
|
76 |
import java.sql.SQLException;
|
- |
|
77 |
import java.util.HashSet;
|
73 |
import java.util.List;
|
78 |
import java.util.List;
|
- |
|
79 |
import java.util.Set;
|
74 |
|
80 |
|
75 |
import javax.swing.JCheckBox;
|
81 |
import javax.swing.JCheckBox;
|
76 |
import javax.swing.JLabel;
|
82 |
import javax.swing.JLabel;
|
77 |
import javax.swing.JOptionPane;
|
83 |
import javax.swing.JOptionPane;
|
78 |
import javax.swing.JPanel;
|
84 |
import javax.swing.JPanel;
|
Line 107... |
Line 113... |
107 |
|
113 |
|
108 |
public ElementComboBox getBoxFournisseur() {
|
114 |
public ElementComboBox getBoxFournisseur() {
|
109 |
return this.fourn;
|
115 |
return this.fourn;
|
110 |
}
|
116 |
}
|
111 |
|
117 |
|
- |
|
118 |
@Override
|
- |
|
119 |
protected Set<String> createRequiredNames() {
|
- |
|
120 |
final Set<String> s = new HashSet<>(4);
|
- |
|
121 |
if (getTable().contains("ID_TYPE_CMD")) {
|
- |
|
122 |
s.add("ID_TYPE_CMD");
|
- |
|
123 |
s.add("DA1");
|
- |
|
124 |
s.add("ID_POLE_PRODUIT");
|
- |
|
125 |
}
|
- |
|
126 |
return s;
|
- |
|
127 |
}
|
- |
|
128 |
|
112 |
public void addViews() {
|
129 |
public void addViews() {
|
113 |
this.setLayout(new GridBagLayout());
|
130 |
this.setLayout(new GridBagLayout());
|
114 |
final GridBagConstraints c = new DefaultGridBagConstraints();
|
131 |
final GridBagConstraints c = new DefaultGridBagConstraints();
|
115 |
|
132 |
|
116 |
// Numero du commande
|
133 |
// Numero du commande
|
Line 182... |
Line 199... |
182 |
if (rowF.getObject("ID_CATEGORIE_COMPTABLE") != null && !rowF.isForeignEmpty("ID_CATEGORIE_COMPTABLE")) {
|
199 |
if (rowF.getObject("ID_CATEGORIE_COMPTABLE") != null && !rowF.isForeignEmpty("ID_CATEGORIE_COMPTABLE")) {
|
183 |
table.setRowCatComptable(rowF.getForeign("ID_CATEGORIE_COMPTABLE"));
|
200 |
table.setRowCatComptable(rowF.getForeign("ID_CATEGORIE_COMPTABLE"));
|
184 |
} else {
|
201 |
} else {
|
185 |
table.setRowCatComptable(null);
|
202 |
table.setRowCatComptable(null);
|
186 |
}
|
203 |
}
|
187 |
|
- |
|
- |
|
204 |
if (getTable().contains("OFFRE_COM")) {
|
- |
|
205 |
((SQLTextCombo) getView("OFFRE_COM").getComp()).setValue(rowF.getString("RESPONSABLE"));
|
- |
|
206 |
}
|
188 |
} else {
|
207 |
} else {
|
189 |
table.setRowCatComptable(null);
|
208 |
table.setRowCatComptable(null);
|
190 |
}
|
209 |
}
|
191 |
}
|
210 |
}
|
192 |
});
|
211 |
});
|
193 |
|
212 |
|
- |
|
213 |
Boolean useCommandeEnCours = SQLPreferences.getMemCached(getElement().getTable().getDBRoot()).getBoolean(GestionCommercialeGlobalPreferencePanel.COMMANDE_FOURNISSEUR_EN_COURS, false);
|
- |
|
214 |
|
194 |
if (!getTable().getFieldsName().contains("LIVRER")) {
|
215 |
if (!getTable().getFieldsName().contains("LIVRER") && useCommandeEnCours) {
|
195 |
// Commande en cours
|
216 |
// Commande en cours
|
196 |
JCheckBox boxEnCours = new JCheckBox(getLabelFor("EN_COURS"));
|
217 |
JCheckBox boxEnCours = new JCheckBox(getLabelFor("EN_COURS"));
|
197 |
c.gridx += 2;
|
218 |
c.gridx += 2;
|
198 |
c.weightx = 0;
|
219 |
c.weightx = 0;
|
199 |
c.fill = GridBagConstraints.HORIZONTAL;
|
220 |
c.fill = GridBagConstraints.HORIZONTAL;
|
Line 1002... |
Line 1023... |
1002 |
}, row, row.getReferentRows(getTable().getTable("COMMANDE_ELEMENT")), TypeStockUpdate.VIRTUAL_RECEPT);
|
1023 |
}, row, row.getReferentRows(getTable().getTable("COMMANDE_ELEMENT")), TypeStockUpdate.VIRTUAL_RECEPT);
|
1003 |
|
1024 |
|
1004 |
stockUpdater.update();
|
1025 |
stockUpdater.update();
|
1005 |
}
|
1026 |
}
|
1006 |
|
1027 |
|
- |
|
1028 |
@Override
|
- |
|
1029 |
public synchronized ValidState getValidState() {
|
- |
|
1030 |
if (getTable().contains("ID_TYPE_CMD") && getTable().contains("ID_AFFAIRE") && getTable().getTable("COMMANDE_ELEMENT").contains("ID_AFFAIRE")) {
|
- |
|
1031 |
SQLRequestComboBox boxAff = (SQLRequestComboBox) getView("ID_AFFAIRE").getComp();
|
- |
|
1032 |
final SQLRow selectedAff = boxAff.getSelectedRow();
|
- |
|
1033 |
if (selectedAff == null || selectedAff.isUndefined()) {
|
- |
|
1034 |
RowValuesTableModel tableRow = this.table.getRowValuesTable().getRowValuesTableModel();
|
- |
|
1035 |
|
- |
|
1036 |
for (int i = 0; i < tableRow.getRowCount(); i++) {
|
- |
|
1037 |
SQLRowValues rowVals = tableRow.getRowValuesAt(i);
|
- |
|
1038 |
if (rowVals.getInt("QTE") != 0 && (rowVals.getObject("ID_AFFAIRE") == null || rowVals.isForeignEmpty("ID_AFFAIRE"))) {
|
- |
|
1039 |
return ValidState.create(false, "Aucune affaire globale sélectionnée et une ligne avec une quantité > 0 n'est pas affectée à une affaire!");
|
- |
|
1040 |
}
|
- |
|
1041 |
}
|
- |
|
1042 |
} else {
|
- |
|
1043 |
ValidState.create(false, "Aucune affaire globale sélectionnée!");
|
- |
|
1044 |
}
|
- |
|
1045 |
}
|
- |
|
1046 |
return super.getValidState();
|
- |
|
1047 |
}
|
- |
|
1048 |
|
1007 |
public void setDefaults() {
|
1049 |
public void setDefaults() {
|
1008 |
this.resetValue();
|
1050 |
this.resetValue();
|
1009 |
this.numeroUniqueCommande.setText(NumerotationAutoSQLElement.getNextNumero(getElement().getClass()));
|
1051 |
this.numeroUniqueCommande.setText(NumerotationAutoSQLElement.getNextNumero(getElement().getClass()));
|
1010 |
this.table.getModel().clearRows();
|
1052 |
this.table.getModel().clearRows();
|
1011 |
}
|
1053 |
}
|