Nouveau bon de commande

Répondre
kylliox
Messages : 2
Enregistré le : jeu. nov. 17, 2016 9:24 am

mer. sept. 27, 2017 6:31 pm

Bonjour,

Impossible de générer un bon de commande à partir de l'interface d'OpenConcerto,

La base de donnée commande contient 538 bon de commande, généré à l'aide d'un script PHP

Il n'y a pas de souci pour créer des commandes fournisseurs ou facture à partir de l'interface d'OpenConcerto,

La base est sous PostgreSQL, Linux Debian.

le problème vient de là je pense : ERREUR: la valeur d'une clé dupliquée rompt la contrainte unique « COMMANDE_CLIENT_pkey » Détail : La clé « ("ID")=(29) » existe déjà.
Il y a peut-être une commande SQL à injecter pour incrémenter cette clé à la bonne valeur mais je ne trouve pas laquelle !

Merci de votre aide

Voici l'affichage renvoyé :

unable to insert SQLRowValues on /COMMANDE_CLIENT/ : {ID_COMMERCIAL=3(class java.lang.Integer), ID_CLIENT=5(class java.lang.Integer), ID_CLIENT_DEPARTEMENT=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), ID_CONTACT=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), DATE_LIVRAISON_PREV=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), ID_ADRESSE=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), ID_ADRESSE_LIVRAISON=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), EMBALLAGE=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), NUMERO_EXPEDITION=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), TYPE_EXPEDITION=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), ETAT_COMMANDE=1(class java.lang.Integer), ID_TARIF=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), T_DEVISE=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), T_ECO_CONTRIBUTION=0(class java.lang.Long), T_HT=0(class java.lang.Long), T_TVA=0(class java.lang.Long), T_TTC=0(class java.lang.Long), T_SERVICE=0(class java.lang.Long), PORT_HT=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), REMISE_HT=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), ID_TAXE_PORT=3(class java.lang.Integer), NOM=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), T_POIDS=0.0(class java.lang.Float), DATE=2017-09-27(class java.sql.Date), NUMERO=CMDCLI349(class java.lang.String), INFOS=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), ID_DEVIS=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1)} using {T_DEVISE=SQLRowValues.SQL_DEFAULT, ID_CLIENT=5, ID_TARIF=SQLRowValues.SQL_DEFAULT, REMISE_HT=SQLRowValues.SQL_DEFAULT, INFOS=SQLRowValues.SQL_DEFAULT, ETAT_COMMANDE=1, ID_CLIENT_DEPARTEMENT=SQLRowValues.SQL_DEFAULT, T_TTC=0, NUMERO_EXPEDITION=SQLRowValues.SQL_DEFAULT, T_TVA=0, TYPE_EXPEDITION=SQLRowValues.SQL_DEFAULT, EMBALLAGE=SQLRowValues.SQL_DEFAULT, ID_DEVIS=SQLRowValues.SQL_DEFAULT, PORT_HT=SQLRowValues.SQL_DEFAULT, DATE_LIVRAISON_PREV=SQLRowValues.SQL_DEFAULT, ID_ADRESSE_LIVRAISON=SQLRowValues.SQL_DEFAULT, ID_CONTACT=SQLRowValues.SQL_DEFAULT, NOM=SQLRowValues.SQL_DEFAULT, ID_TAXE_PORT=3, T_HT=0, T_ECO_CONTRIBUTION=0, DATE=2017-09-27, ID_COMMERCIAL=3, NUMERO=CMDCLI349, T_SERVICE=0, ID_ADRESSE=SQLRowValues.SQL_DEFAULT, T_POIDS=0.0}
org.openconcerto.utils.ExceptionHandler: Impossible d'insérer
at org.openconcerto.utils.ExceptionHandler.handle(ExceptionHandler.java:121)
at org.openconcerto.sql.element.BaseSQLComponent.insert(BaseSQLComponent.java:705)
at org.openconcerto.erp.core.common.component.TransfertBaseSQLComponent.insert(TransfertBaseSQLComponent.java:111)
at org.openconcerto.erp.core.sales.order.component.CommandeClientSQLComponent.insert(CommandeClientSQLComponent.java:725)
at org.openconcerto.sql.element.BaseSQLComponent.insert(BaseSQLComponent.java:693)
at org.openconcerto.sql.view.EditPanel.ajouter(EditPanel.java:475)
at org.openconcerto.sql.view.EditPanel.actionPerformed(EditPanel.java:439)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.sql.SQLException: unable to insert SQLRowValues on /COMMANDE_CLIENT/ : {ID_COMMERCIAL=3(class java.lang.Integer), ID_CLIENT=5(class java.lang.Integer), ID_CLIENT_DEPARTEMENT=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), ID_CONTACT=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), DATE_LIVRAISON_PREV=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), ID_ADRESSE=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), ID_ADRESSE_LIVRAISON=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), EMBALLAGE=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), NUMERO_EXPEDITION=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), TYPE_EXPEDITION=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), ETAT_COMMANDE=1(class java.lang.Integer), ID_TARIF=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), T_DEVISE=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), T_ECO_CONTRIBUTION=0(class java.lang.Long), T_HT=0(class java.lang.Long), T_TVA=0(class java.lang.Long), T_TTC=0(class java.lang.Long), T_SERVICE=0(class java.lang.Long), PORT_HT=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), REMISE_HT=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), ID_TAXE_PORT=3(class java.lang.Integer), NOM=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), T_POIDS=0.0(class java.lang.Float), DATE=2017-09-27(class java.sql.Date), NUMERO=CMDCLI349(class java.lang.String), INFOS=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1), ID_DEVIS=SQLRowValues.SQL_DEFAULT(class org.openconcerto.sql.model.SQLRowValues$1)} using {T_DEVISE=SQLRowValues.SQL_DEFAULT, ID_CLIENT=5, ID_TARIF=SQLRowValues.SQL_DEFAULT, REMISE_HT=SQLRowValues.SQL_DEFAULT, INFOS=SQLRowValues.SQL_DEFAULT, ETAT_COMMANDE=1, ID_CLIENT_DEPARTEMENT=SQLRowValues.SQL_DEFAULT, T_TTC=0, NUMERO_EXPEDITION=SQLRowValues.SQL_DEFAULT, T_TVA=0, TYPE_EXPEDITION=SQLRowValues.SQL_DEFAULT, EMBALLAGE=SQLRowValues.SQL_DEFAULT, ID_DEVIS=SQLRowValues.SQL_DEFAULT, PORT_HT=SQLRowValues.SQL_DEFAULT, DATE_LIVRAISON_PREV=SQLRowValues.SQL_DEFAULT, ID_ADRESSE_LIVRAISON=SQLRowValues.SQL_DEFAULT, ID_CONTACT=SQLRowValues.SQL_DEFAULT, NOM=SQLRowValues.SQL_DEFAULT, ID_TAXE_PORT=3, T_HT=0, T_ECO_CONTRIBUTION=0, DATE=2017-09-27, ID_COMMERCIAL=3, NUMERO=CMDCLI349, T_SERVICE=0, ID_ADRESSE=SQLRowValues.SQL_DEFAULT, T_POIDS=0.0}
at org.openconcerto.sql.model.SQLRowValues.insertJustThis(SQLRowValues.java:1882)
at org.openconcerto.sql.model.SQLRowValuesCluster$Insert.execOn(SQLRowValuesCluster.java:1636)
at org.openconcerto.sql.model.SQLRowValuesCluster$Node.store(SQLRowValuesCluster.java:1540)
at org.openconcerto.sql.model.SQLRowValuesCluster$Node.store(SQLRowValuesCluster.java:1535)
at org.openconcerto.sql.model.SQLRowValuesCluster$Node.access$3(SQLRowValuesCluster.java:1534)
at org.openconcerto.sql.model.SQLRowValuesCluster$2.handle(SQLRowValuesCluster.java:486)
at org.openconcerto.sql.model.SQLRowValuesCluster$2.handle(SQLRowValuesCluster.java:1)
at org.openconcerto.sql.utils.SQLUtils$2.handle(SQLUtils.java:149)
at org.openconcerto.sql.model.ConnectionHandler.compute(ConnectionHandler.java:59)
at org.openconcerto.sql.model.SQLDataSource.useConnection(SQLDataSource.java:883)
at org.openconcerto.sql.model.SQLDataSource.useConnection(SQLDataSource.java:847)
at org.openconcerto.sql.utils.SQLUtils.executeAtomic(SQLUtils.java:127)
at org.openconcerto.sql.utils.SQLUtils.executeAtomic(SQLUtils.java:99)
at org.openconcerto.sql.model.SQLRowValuesCluster.store(SQLRowValuesCluster.java:453)
at org.openconcerto.sql.model.SQLRowValuesCluster.store(SQLRowValuesCluster.java:372)
at org.openconcerto.sql.model.SQLRowValuesCluster.store(SQLRowValuesCluster.java:367)
at org.openconcerto.sql.model.SQLRowValues.store(SQLRowValues.java:1853)
at org.openconcerto.sql.model.SQLRowValues.insert(SQLRowValues.java:1833)
at org.openconcerto.sql.request.SQLRowView.insert(SQLRowView.java:344)
at org.openconcerto.sql.element.BaseSQLComponent.insert(BaseSQLComponent.java:701)
... 42 more
Caused by: java.sql.SQLException: Unable to insert INSERT INTO "OpenConcerto"."OpenConcerto48"."COMMANDE_CLIENT" ("MODIFICATION_DATE", "ID_USER_COMMON_MODIFY", "CREATION_DATE", "ID_USER_COMMON_CREATE", "ID_CLIENT", "ETAT_COMMANDE", "T_TTC", "T_TVA", "ID_TAXE_PORT", "T_HT", "T_ECO_CONTRIBUTION", "DATE", "ID_COMMERCIAL", "NUMERO", "T_SERVICE", "T_POIDS", "ORDRE") select '2017-09-27 20:22:34.672000 +02:00:00', 2, '2017-09-27 20:22:34.672000 +02:00:00', 2, 5, 1, 0, 0, 3, 0, 0, '2017-09-27 +02:00:00', 3, 'CMDCLI349', 0, 0.0, COALESCE(MAX("ORDRE"), 0) + 1 FROM "OpenConcerto"."OpenConcerto48"."COMMANDE_CLIENT" RETURNING "ID"
at org.openconcerto.sql.model.SQLRowValues$6.handle(SQLRowValues.java:1870)
at org.openconcerto.sql.model.SQLRowValues$6.handle(SQLRowValues.java:1)
at org.openconcerto.sql.model.ConnectionHandler.compute(ConnectionHandler.java:59)
at org.openconcerto.sql.model.SQLDataSource.useConnection(SQLDataSource.java:883)
at org.openconcerto.sql.model.SQLDataSource.useConnection(SQLDataSource.java:847)
at org.openconcerto.sql.model.SQLRowValues.insertJustThis(SQLRowValues.java:1860)
... 61 more
Caused by: org.postgresql.util.PSQLException: ERREUR: la valeur d'une clé dupliquée rompt la contrainte unique « COMMANDE_CLIENT_pkey »
Détail : La clé « ("ID")=(29) » existe déjà.
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:410)
at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
at org.openconcerto.sql.model.SQLRowValues.insert(SQLRowValues.java:2330)
at org.openconcerto.sql.model.SQLRowValues$6.handle(SQLRowValues.java:1865)
... 66 more
Elminster
Messages : 78
Enregistré le : lun. mars 27, 2017 12:51 pm

mer. sept. 27, 2017 7:54 pm

bonsoir.
la réponse est simple (j'ai eu le même probleme après des intégrations d'articles, c'est pour ça queje peux dire "facile" :-)). le script utilisé pour intégrer vos bons de commande n'a pas mis à jour l'id de la prochaine commande. Cette ID est est stockée dans le schéma de votre société/sequences/COMMANDE_ID_seq... (accessible via pgaqdmin par exemple)
il suffit de se rendre dans la bonne sequence, de faire un clic droit [propriété] et dans l'onglet [definition] il y a valeur actuelle, vous remplacez le 29 par le nouveau numéro du bon de commande (il est resté sur l'ID 29, dernière ID utilisée avant l'intégration par scripts des bons de commande...) et le tour est joué.
bonne utilisation
kylliox
Messages : 2
Enregistré le : jeu. nov. 17, 2016 9:24 am

jeu. sept. 28, 2017 6:55 am

Super, merci Elminster
tvans
Messages : 52
Enregistré le : mar. oct. 04, 2016 2:28 pm

ven. oct. 06, 2017 10:02 am

Super GG Elminster
ça m'a aussi dépanné :idea:
HerbeMannABg
Messages : 1
Enregistré le : dim. oct. 15, 2017 8:47 am
Localisation : Poland
Contact :

sam. oct. 21, 2017 8:00 am

oui je fais commercial a temps partiel pour TAT Concept

Mais peut etre que jai vraiment envie dun porte cle avec le bon n° 5003 et pas 848

bon 20 ex en 2 jours ca commence a prendre forme
Elminster
Messages : 78
Enregistré le : lun. mars 27, 2017 12:51 pm

sam. oct. 21, 2017 8:43 am

peut-être mais légalement parlant("impôtétiquement" dirons nous : -) ), ce n'est pas censé être possible : tous les éléments de gestion devis, bons de commande, bons de livraison, facture sont censé avoir une numérotation en continu.
Après rien n’empêche que tu le forces manuellement en stoppant l’incrémentation automatique des numéros dans les préférences d'OC. mais dans ce cas-la il te faudra ensuite les saisir manuellement à chaque fois...
donc regarder quel était le numéro précédent pour ensuite saisir le numéro suivant, sauf les fois ou tu veux u numéro particulier..
et à un moment donné tu te retrouves avec un numéro déjà existant et un plantage du système.. toujours au mauvais moment normalement :- c'est à dire quand tu es pressé !
Répondre