SHARE
TWEET

doSyncControleLimpeza

a guest Jan 23rd, 2020 121 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. procedure TDM.doSyncControleLimpeza;
  2. begin
  3.   qryAux.Close;
  4.   qryAux.SQL.Clear;
  5.   qryAux.SQL.Add('select * from CONTROLE_LIMPEZA');
  6.   qryAux.SQL.Add('where SINCRONIZADO = ''N''');
  7.   qryAux.SQL.Add('order by ID');
  8.   qryAux.Open();
  9.   qryAux.First;
  10.  
  11.   RESTDWClientSQL1.Close;
  12.   RESTDWClientSQL1.BinaryRequest := True;
  13.   RESTDWClientSQL1.SQL.Clear;
  14.   RESTDWClientSQL1.SQL.Add('insert into CONTROLE_LIMPEZA (USUARIO, DATA_INI, HORA_INI, DATA_FIM, HORA_FIM, OBSERVACAO, FOTO, CNPJ_EMPRESA,');
  15.   RESTDWClientSQL1.SQL.Add('                              RED_POS, COD_SETOR, COD_SECAO, COD_SUBSECAO, COD_LIMPEZA)');
  16.   RESTDWClientSQL1.SQL.Add('values (:USUARIO, :DATA_INI, :HORA_INI, :DATA_FIM, :HORA_FIM, :OBSERVACAO, :FOTO, :CNPJ_EMPRESA,');
  17.   RESTDWClientSQL1.SQL.Add('        :RED_POS, :COD_SETOR, :COD_SECAO, :COD_SUBSECAO, :COD_LIMPEZA)');
  18.  
  19.   while not qryAux.Eof do begin
  20.     RESTDWClientSQL1.ParamByName('USUARIO').AsString    :=  qryAux.FieldByName('USUARIO').AsString;
  21.     RESTDWClientSQL1.ParamByName('DATA_INI').AsDate     :=  qryAux.FieldByName('DATA_INI').AsDateTime;
  22.     RESTDWClientSQL1.ParamByName('HORA_INI').AsTime     :=  qryAux.FieldByName('HORA_INI').AsDateTime;
  23.     RESTDWClientSQL1.ParamByName('DATA_FIM').AsDate     :=  qryAux.FieldByName('DATA_FIM').AsDateTime;
  24.     RESTDWClientSQL1.ParamByName('HORA_FIM').AsTime     :=  qryAux.FieldByName('HORA_FIM').AsDateTime;
  25.     RESTDWClientSQL1.ParamByName('OBSERVACAO').AsString :=  qryAux.FieldByName('OBSERVACAO').AsString;
  26.     if not qryAux.FieldByName('FOTO').IsNull then
  27.       RESTDWClientSQL1.ParamByName('FOTO').Assign(qryAux.FieldByName('FOTO'));
  28.     RESTDWClientSQL1.ParamByName('CNPJ_EMPRESA').AsString   :=  qryAux.FieldByName('CNPJ_EMPRESA').AsString;
  29.     RESTDWClientSQL1.ParamByName('RED_POS').AsString        :=  qryAux.FieldByName('RED_POS').AsString;
  30.     RESTDWClientSQL1.ParamByName('COD_SETOR').AsInteger     :=  qryAux.FieldByName('COD_SETOR').AsInteger;
  31.     RESTDWClientSQL1.ParamByName('COD_SECAO').AsInteger     :=  qryAux.FieldByName('COD_SECAO').AsInteger;
  32.     RESTDWClientSQL1.ParamByName('COD_SUBSECAO').AsInteger  :=  qryAux.FieldByName('COD_SUBSECAO').AsInteger;
  33.     RESTDWClientSQL1.ParamByName('COD_LIMPEZA').AsInteger   :=  qryAux.FieldByName('COD_LIMPEZA').AsInteger;
  34.  
  35.     RESTDWClientSQL1.ExecSQL;
  36.  
  37.     qryAux.Edit;
  38.     qryAux.FieldByName('SINCRONIZADO').AsString := 'S';
  39.     qryAux.Post;
  40.  
  41.     qryAux.Next;
  42.   end;
  43.   RESTDWClientSQL1.BinaryRequest := False;
  44. end;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top