|
Impossible de déconnecter Socket & problème TABLE |
Iniciado por Julie, 09,abr. 2014 15:50 - 1 respuesta |
| |
| | | |
|
| |
Publicado el 09,abril 2014 - 15:50 |
Bonjour à tous,
Je travaille sous Windev Mobile 17. Je travaille sur un scan PSION 7535 qui se connecte à un serveur de Socket Delphi. Je scanne des colis qui vont sur une palette hétérogène appelée UMX. j'ai un bouton qui me permet d'afficher dans un tableau la liste de mes colis.
Voici le code Delphi qui m'envoi tous les colis :
Procedure ListeUCUMX(x_Addip : string; x_User : string; x_dep : string; x_Umx : string; x_Mod : string; x_Act : string; os_Session : TOracleSession; ss_Socket : TServerSocket; n_id : integer; m_Trace : TMemo); var oq_umx : TOracleQuery; i : integer; t_colis : array[1..100] of string; x_reponse : string; x_lec: string;
begin try x_lec := RetourneNomScan(x_addIp, os_Session);
oq_umx := TOracleQuery.Create(Nil); oq_umx.Session := os_Session;
oq_umx.Close; oq_umx.SQL.Clear; oq_umx.SQL.Add('select CUCXUCM from UCMXRES WHERE CUMXUCM='''+x_umx+''' AND DEPXUCM='''+x_dep+''''); IF TestRequete1(oq_umx, 'OPENREQ', 'Echec récupération colis UMX(UnitCtrlML - 070)', os_Session) THEN begin i := 0; IF oq_Umx.Eof THEN begin envoiMsgSocket(n_id, x_Umx, 'PASUCUMX', ss_Socket, m_Trace); exit; END; WHILE not oq_umx.Eof DO begin inc(i); t_colis[i] := oq_umx.FieldAsString('CUCXUCM'); IF i <> 0 THEN begin x_reponse := ''; x_reponse := 'C'; x_reponse := x_reponse +TAB+ t_colis[i]; envoiMsgSocket(n_id, x_Umx, x_reponse, ss_Socket, m_Trace); END; oq_umx.Next; END; END; IF i=0 THEN begin END; IF i>0 THEN begin envoiMsgSocket(n_id, x_Umx, 'FINCOLISUMX', ss_Socket, m_Trace); maj_raoxres(x_User, x_Lec, x_Mod, x_act, '', '', '', x_Dep, '', 'CTRL CMD M&L - Liste UC de UMX' +TAB+ x_umx, '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 'N', 'N', 'N', 'A', os_Session); exit; END; finally oq_umx.Close; oq_umx.Free; END; END;
Le problème vient côté WD. Si j'ai moins de 19 colis sur ma palette pas de problème tout s'affiche dans ma TABLE et mon scan reçoit le FINCOLISUMX et procède donc à une déconnexion. Au delà de 19 palettes, je n'affiche que 19 palettes et la socket n'est pas déconnectée (je ne reçois plus de messages d'elle au dela de mes 19 colis elle ne peut donc pas recevoir le message de déconnexion).
Le code qui appelle ma procédure de remplissage de la TABLE :
CAS C = Cas où je récupère mes colis
SINON SI ExtraitChaîne(sMessage, 1,TAB) = "C" ALORS FENAccueil..Plan = 67 FENAccueil.TABLE_UMX.COL_Colis..Titre = "Colis de l'UMX " + gsNumUmx
GestionAffichageControleML4(sMessage) FIN
Procédure de GestionAffichageControleML4(sMessage) qui me permet d'afficher dans ma TABLE :
Procedure GestionAffichageControleML4(sMessage)
gbFinColisUmx = Vrai
sColis est une chaîne = ""
sColis = ExtraitChaîne(sMessage, 2, TAB)
SI sColis <> "" ALORS
TableAjouteLigne(FENAccueil.TABLE_UMX, sColis)
SI gbFinColisUmx = Vrai ALORS
Reception() FIN FIN
Le code qui me permet de déconnecter ma Socket (fonction LitSocket):
CAS "FINCOLISUMX"
Info("toto") SocketFerme(csNomSocket) FENAccueil.BTN_DelUC..Etat = Actif gbFinColisUmx = Faux
Voilà je ne sais plus quoi faire j'ai tout testé ... je ne vois pas quoi faire d'autre |
| |
| |
| | | |
|
| | |
| |
Publicado el 10,abril 2014 - 08:51 |
J'ai procédé autrement du coup :
Côté Delphi je stocke tout dans une variable et une fois récupéré j'envoi tout :
Code Delphi :
Procedure ListeUCUMX(x_Addip : string; x_User : string; x_dep : string; x_Umx : string; x_Mod : string; x_Act : string; os_Session : TOracleSession; ss_Socket : TServerSocket; n_id : integer; m_Trace : TMemo); var oq_umx : TOracleQuery; i : integer; t_colis : array[1..100] of string; x_reponse : string; x_lec: string;
begin try x_lec := RetourneNomScan(x_addIp, os_Session);
x_reponse := 'C';
oq_umx := TOracleQuery.Create(Nil); oq_umx.Session := os_Session;
oq_umx.Close; oq_umx.SQL.Clear; oq_umx.SQL.Add('select CUCXUCM from UCMXRES WHERE CUMXUCM='''+x_umx+''' AND DEPXUCM='''+x_dep+''''); IF TestRequete1(oq_umx, 'OPENREQ', 'Echec récupération colis UMX(UnitCtrlML - 070)', os_Session) THEN begin i := 0; IF oq_Umx.Eof THEN begin envoiMsgSocket(n_id, x_Umx, 'PASUCUMX', ss_Socket, m_Trace); exit; END; WHILE not oq_umx.Eof DO begin inc(i); t_colis[i] := oq_umx.FieldAsString('CUCXUCM'); IF i <> 0 THEN begin x_reponse := x_reponse +TAB+ t_colis[i]; END; oq_umx.Next; END; END; IF i=0 THEN begin END; IF i>0 THEN begin envoiMsgSocket(n_id, x_Umx, x_reponse +TAB+ 'FINCOLISUMX', ss_Socket, m_Trace); maj_raoxres(x_User, x_Lec, x_Mod, x_act, '', '', '', x_Dep, '', 'CTRL CMD M&L - Liste UC de UMX' +TAB+ x_umx, '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 'N', 'N', 'N', 'A', os_Session); exit; END; finally oq_umx.Close; oq_umx.Free; END; END;
Et côté Windev j'affiche dans ma TABLE :
Procedure GestionAffichageControleML4(sMessage)
gbFinColisUmx = Vrai
sColis est une chaîne = ""
sColis = ExtraitChaîne(sMessage, 2, TAB)
POUR i = 2 A 100 SI ExtraitChaîne(sMessage,i,TAB) <> "" ET ExtraitChaîne(sMessage,i,TAB) <> EOT ALORS SI ExtraitChaîne(sMessage,i,TAB) <> "FINCOLISUMX" ALORS TableAjouteLigne(FENAccueil.TABLE_UMX, ExtraitChaîne(sMessage,i,TAB)) SINON DeconnexionSocket(csNomSocket) FENAccueil.BTN_DelUC..Etat = Actif FIN FIN
FIN
Voilà si ça peut aider quelqu'un. |
| |
| |
| | | |
|
| | | | |
| | |
|