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
| FDMemArticles.CloneCursor(Datas.FDLiaisonArticles); // récupération des données interne
FDMemArticles.First;
TTask.Run(
procedure
const UpdateSQL='UPDATE EAN13_CLIENT SET PSID_PRODUCT=?,PSID_ATTRIBUTE=?,PS8ISTOCK=? '+
' WHERE IDUNIQUE=?';
begin
while not FDMemArticles.EOF do
begin
if boutique<>FDMemArticles.FieldByName('BOUTIQUE').AsString then
begin
boutique:=FDMemArticles.FieldByName('BOUTIQUE').AsString;
with datas do
begin
FDAdresse.Open('',[boutique]);
RESTIdentificateur.Username:=DecryptString(FDAdresse.FieldByName('ACCES').AsString,
boutique);
end;
end;
RQArticle.Params.ParameterByIndex(0).Value:=FDMemArticles.FieldByName('CODE25I').AsString;
try
RQArticle.Execute; // autre sujet dans forum web&reseau à propos du Rest
RQAvailable.Params.ParameterByIndex(0).Value:=PrestaArticle.FieldByName('id_product').asString;
RQAvailable.Params.ParameterByIndex(1).Value:=PrestaArticle.FieldByName('id').asString;
FDMemArticles.Edit;
try
RQAvailable.Execute;
if RQAvailable.Response.StatusCode<>200 then
FDMemArticles.FieldByName('COMMENTPROCESS').AsString:=RQAvailable.Response.StatusCode.ToString
else
FDMemArticles.FieldByName('PS_IDSTOCK').AsString:=Available.FieldByName('id').asString;
except
FDMemArticles.FieldByName('COMMENTPROCESS').AsString:='pas de stock !!'
end;
FDMemArticles.FieldByName('PSID_PRODUCT').AsString:=PrestaArticle.FieldByName('id_product').asString;
FDMemArticles.FieldByName('PSID_ATTRIBUTE').AsString:=PrestaArticle.FieldByName('id').asString;
if Trim(FDMemArticles.FieldByName('COMMENTPROCESS').AsString).isEmpty then
FDMemArticles.FieldByName('COMMENTPROCESS').AsString:='ok';
FDMemArticles.Post;
// mise à jour
// Datas.ConnexionBase.ExecSQL(UpdateSQL,
// ([FMemArticles.FieldByName('PSID_PRODUCT').AsString,
// FMemArticles.FieldByName('PSID_ATTRIBUTE').AsString,
// FMemArticles.FieldByName('PS_IDSTOCK').AsString,
// FMemArticles.FieldByName('IDUNIQUE').Asinteger]));
except
FDMemArticles.Edit;
FDMemArticles.FieldByName('COMMENTPROCESS').AsString:='pas en boutique';
FDMemArticles.Post;
end;
TThread.Synchronize(nil,
procedure
begin
end);
FDMemArticles.Next;
end;
TThread.Synchronize(nil,
procedure
begin
FDMemArticles.First;
// WorkProgress.Visible := False;
end);
end); |
Partager