1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
|
// je donne le bon SQL au Query
q_Search_gr_.Close;
q_Search_gr_.SQL.Clear;
q_Search_gr_.SQL.Add('SELECT ' +L_Nom_Table_Hist.Caption + '.* FROM ' +L_Nom_Table_Hist.Caption);
q_Search_gr_.SQL.Add('where (ID_GRUME_H =:id_torro) and (IDX =:idc) and (N_ABAT =:Torro) and (ESSENCE =:gazolina) order by ID_HIST_GRUNE_H');
q_procura_agenda_grume_2.Close;
q_procura_agenda_grume_2.Open;
q_procura_agenda_grume_2.First;
while not q_procura_agenda_grume_2.Eof do
begin
tb_Destination_.Close;
tb_Destination_.Open;
tb_Destination_.First;
//procura se o torro ja nao existe
if tb_Destination_.Locate('ID_GRUME_H; IDX; N_ABAT; ESSENCE', VarArrayOf([q_procura_agenda_grume_2ID_GRUME_H.Value, q_procura_agenda_grume_2IDX.value, q_procura_agenda_grume_2N_ABAT.value, q_procura_agenda_grume_2ESSENCE.value]), []) then
begin
showMessage('grume existe ' +inttostr(q_procura_agenda_grume_2ID_GRUME_H.Value) +' ' +q_procura_agenda_grume_2IDX.Value +' ' +inttostr(q_procura_agenda_grume_2N_ABAT.Value) +' ' +q_procura_agenda_grume_2ESSENCE.value );
tb_Destination_.Close;
q_procura_agenda_grume_2.Next;
end
ELSE
begin
//busca do Historico do torro
q_Search_gr_.Close;
q_Search_gr_.Parameters[0].value := q_procura_agenda_grume_2ID_GRUME_H.Value; //Nr. grume origine
q_Search_gr_.Parameters[1].value := q_procura_agenda_grume_2IDX.Value;
q_Search_gr_.Parameters[2].value := q_procura_agenda_grume_2N_ABAT.Value;
q_Search_gr_.Parameters[3].value := q_procura_agenda_grume_2ESSENCE.Value;
// ProgressBar1.Max := q_Search_gr_.RecordCount;
//ShowMessage('TRF de HISTORIQUE ...');
tb_Destination_Hist_.Close;
tb_Destination_Hist_.Open;
q_Search_gr_.Open;
q_Search_gr_.First;
//q_Search_gr_.Refresh;
while not q_Search_gr_.Eof do
begin
q_Search_gr_.Refresh; //NE FAIT RIEN!!!
//enreg Antécédents ds l'Historique
tb_Destination_Hist_.Append;
tb_Destination_Hist_ID_GRUME_H.Value := q_Search_gr_ID_GRUME_H.Value;
tb_Destination_Hist_IDX.Value := q_Search_gr_IDX.Value;
tb_Destination_Hist_N_ABAT.Value := q_Search_gr_N_ABAT.Value;
tb_Destination_Hist_ESSENCE.Value := q_Search_gr_ESSENCE.Value;
tb_Destination_Hist_LONG.Value := q_Search_gr_LONG.Value;
tb_Destination_Hist_DIAM_AA.Value := q_Search_gr_DIAM_AA.Value;
tb_Destination_Hist_DIAM_SA.Value := q_Search_gr_DIAM_SA.Value;
tb_Destination_Hist_VOL_AA.Value := q_Search_gr_VOL_AA.Value;
tb_Destination_Hist_VOL_SA.Value := q_Search_gr_VOL_SA.Value;
tb_Destination_Hist_POIDS.Value := q_Search_gr_POIDS.Value;
tb_Destination_Hist_PURGE.Value := q_Search_gr_PURGE.Value;
tb_Destination_Hist_PURGE_NBR.Value:= q_Search_gr_PURGE_NBR.Value;
tb_Destination_Hist_REFACTION.Value:= q_Search_gr_REFACTION.Value;
tb_Destination_Hist_POSITION.Value := q_Search_gr_POSITION.Value;
tb_Destination_Hist_OBS.Value := q_Search_gr_OBS.Value;
tb_Destination_Hist_D_ARR_NIOKI.Value:= q_Search_gr_D_ARR_NIOKI.Value;
tb_Destination_Hist_D_ARR_KIN.Value := q_Search_gr_D_ARR_KIN.Value;
tb_Destination_Hist_DENSITE.Value := q_Search_gr_DENSITE.Value;
tb_Destination_Hist_executeur.Value:= q_Search_gr_EXECUTEUR.Value;
tb_Destination_Hist_D_ENREG.Value := q_Search_gr_D_ENREG.Value; //date du Mvts
tb_Destination_Hist_DATA_BE.Value := q_Search_gr_DATA_BE.Value;
tb_Destination_Hist_BE.Value := q_Search_gr_BE.Value;
tb_Destination_Hist_TRANSP.Value := q_Search_gr_TRANSP.Value;
tb_Destination_Hist_INFOS_TRANSP.Value:= q_Search_gr_INFOS_TRANSP.Value;
tb_Destination_Hist_CLASS.Value := q_Search_gr_CLASS.Value;
tb_Destination_Hist_T.Value := q_Search_gr_T.Value;
tb_Destination_Hist_.Post;
//q_Search_gr_.Delete;
showMessage('seguinte');
q_Search_gr_.Next;
end;
tb_GRUME_H_.Close;
tb_GRUME_H_.Open;
tb_GRUME_H_.Locate('ID_GRUME_H; IDX; N_ABAT; ESSENCE', VarArrayOf([q_procura_agenda_grume_2ID_GRUME_H.Value, q_procura_agenda_grume_2IDX.value, q_procura_agenda_grume_2N_ABAT.Value, q_procura_agenda_grume_2ESSENCE.value]), []);
tb_Destination_.Close;
tb_Destination_.Open;
tb_Destination_.Append;
tb_Destination_ID_GRUME_H.Value := tb_GRUME_H_ID_GRUME_H.Value;
tb_Destination_IDX.Value := tb_GRUME_H_IDX.Value;
tb_Destination_N_RECEP.Value := tb_GRUME_H_N_RECEP.Value;
tb_Destination_N_ABAT.Value := tb_GRUME_H_N_ABAT.Value;
tb_Destination_L_ABAT.Value := tb_GRUME_H_L_ABAT.Value;
tb_Destination_D_ENREG.Value := tb_GRUME_H_D_ENREG.Value;
//Chg. 02.09.09 p/ inclure le N.Bord. Expedition tb_GRUME_H_B_SAVE.Value;
//tb_Destination_D_SAVE.Value := tb_GRUME_H_D_SAVE.Value;
//tb_Destination_B_SAVE.Value := tb_GRUME_H_B_SAVE.Value;
tb_Destination_D_SAVE.Value := tb_GRUME_H_D_SAVE.Value;
tb_Destination_B_SAVE.Value := tb_GRUME_H_B_SAVE.Value;
tb_Destination_PERMIS.Value := tb_GRUME_H_PERMIS.Value;
tb_Destination_PROSPECT.Value := tb_GRUME_H_PROSPECT.Value;
tb_Destination_PARCELLE.Value := tb_GRUME_H_PARCELLE.Value;
tb_Destination_N_EXPORT.Value := tb_GRUME_H_N_EXPORT.Value;
tb_Destination_ESSENCE.Value := tb_GRUME_H_ESSENCE.Value;
tb_Destination_CHANTIER.Value := tb_GRUME_H_CHANTIER.Value;
tb_Destination_CORRESPOND.Value := tb_GRUME_H_CORRESPOND.Value;
tb_Destination_DECOUPE.Value := tb_GRUME_H_DECOUPE.Value;
tb_Destination_Q.Value := tb_GRUME_H_Q.Value;
tb_Destination_LIC.Value := tb_GRUME_H_LIC.Value;
tb_Destination_PREVISION.Value := tb_GRUME_H_PREVISION.Value;
tb_Destination_B_EXPED_KIN_MDI_D.Value := tb_GRUME_H_B_EXPED_KIN_MDI_D.Value;
tb_Destination_B_EXPED_KIN_MDI.Value := tb_GRUME_H_B_EXPED_KIN_MDI.Value;
tb_Destination_TRANSPORTEUR.Value := tb_GRUME_H_TRANSPORTEUR.Value;
tb_Destination_N_CONTENEUR.Value := tb_GRUME_H_N_CONTENEUR.Value;
tb_Destination_D_EXPORT.Value := tb_GRUME_H_D_EXPORT.Value;
tb_Destination_N_BL.Value := tb_GRUME_H_N_BL.Value;
tb_Destination_BATEAU_EXP.Value := tb_GRUME_H_BATEAU_EXP.Value;
tb_Destination_DESTINATION.Value := tb_GRUME_H_DESTINATION.Value;
tb_Destination_OBS.Value := tb_GRUME_H_OBS.Value +' +GRUME_H_NIOKI_EXPED_ ';
tb_Destination_ORIGINE_GR.Value := tb_GRUME_H_ORIGINE_GR.Value;
tb_Destination_EXECUTEUR.Value := tb_GRUME_H_EXECUTEUR.Value +L_nom_uti.Caption;
tb_Destination_LONG.Value := tb_GRUME_H_LONG.Value;
tb_Destination_DIAM_AA.Value := tb_GRUME_H_DIAM_AA.Value;
tb_Destination_DIAM_AA1.Value := tb_GRUME_H_DIAM_AA1.Value;
tb_Destination_DIAM_AA2.Value := tb_GRUME_H_DIAM_AA2.Value;
tb_Destination_DIAM_AA3.Value := tb_GRUME_H_DIAM_AA3.Value;
tb_Destination_DIAM_AA4.Value := tb_GRUME_H_DIAM_AA4.Value;
tb_Destination_DIAM_SA.Value := tb_GRUME_H_DIAM_SA.Value;
tb_Destination_DIAM_SA1.Value := tb_GRUME_H_DIAM_SA1.Value;
tb_Destination_DIAM_SA2.Value := tb_GRUME_H_DIAM_SA2.Value;
tb_Destination_DIAM_SA3.Value := tb_GRUME_H_DIAM_SA3.Value;
tb_Destination_DIAM_SA4.Value := tb_GRUME_H_DIAM_SA4.Value;
tb_Destination_VOL_AA.Value := tb_GRUME_H_VOL_AA.Value;
tb_Destination_VOL_SA.Value := tb_GRUME_H_VOL_SA.Value;
tb_Destination_POIDS.Value := tb_GRUME_H_POIDS.Value;
tb_Destination_REFACTION.Value := tb_GRUME_H_REFACTION.Value;
tb_Destination_POSICAO.Value := tb_GRUME_H_POSICAO.Value;
tb_Destination_CLASS.Value := tb_GRUME_H_CLASS.Value;
tb_Destination_.Post;
tb_GRUME_H_.Delete; //aki Delete pq moudou de tabela
q_procura_agenda_grume_2.Next; // para a trf
// ProgressBar1.Position := 0;
end;
end; |
Partager