Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure TForm2.Button4Click(Sender: TObject);
- var
- JSON: TJSONObject;
- JSON1: TJSONArray;
- track: string;
- track1: string;
- track2: TJSONArray;
- result1:string;
- temp: string;
- km_count, str_time, departure_from, temp1, temp2: string;
- i, j, count2, grid_counter, mass_counter: integer;
- count1 : double;
- arr_flag: array [0..100] of string;
- myDate : TDateTime;
- checker: string;
- arr_stop: array [0..100] of string;
- counter3: integer;
- counter2: integer;
- counter1: integer;
- qwe: string;
- begin
- Chromium1.Browser.MainFrame.ExecuteJavaScript('delete_track()','about:blank', 0);
- counter := 0;
- counter1 := 0;
- counter2 := 0;
- counter3 := 0;
- o := 0;
- p := 0;
- l := 0;
- dynRESTreq.Params.AddItem('svc', 'report/exec_report', TRESTRequestParameterKind.pkGETorPOST);
- dynRESTreq.Params.AddItem('params', '{"reportResourceId":14464460,"reportTemplateId":2,"reportTemplate":null,"reportObjectId":14453179,"reportObjectSecId":0,"interval":{"flags":16777216,"from":1481500800,"to":1486021378}}', TRESTRequestParameterKind.pkGETorPOST);
- dynRESTreq.Params.AddItem('sid', result ,TRESTRequestParameterKind.pkGETorPOST);
- dynRESTreq.Execute;
- str_report := dynRESTresp.Content;
- Json := TJSONObject.ParseJSONValue(str_report) as TJSONObject;
- if not Assigned(JSON) then raise Exception.Create('Файл не содержит JSON-данные');
- dynRESTreq.Params.AddItem('svc', 'report/select_result_rows', TRESTRequestParameterKind.pkGETorPOST);
- dynRESTreq.Params.AddItem('params', '{"tableIndex":0,"config":{"type":"range","data":{"from":0,"to":100,"level":0}}}', TRESTRequestParameterKind.pkGETorPOST);
- dynRESTreq.Params.AddItem('sid', result ,TRESTRequestParameterKind.pkGETorPOST);
- dynRESTreq.Execute;
- str_report := '';
- str_report := dynRESTresp.Content;
- Json1 := TJSONObject.ParseJSONValue(str_report) as TJSONArray;
- if not Assigned(JSON1) then raise Exception.Create('Файл не содержит JSON-данные');
- for i := 0 to Json1.Size-1 do begin
- track2 := ((Json1.Get(i) as TJSONObject).Get('c').JsonValue as TJSONArray);
- if (ContainsText(track2.ToString, 'y') and ContainsText(track2.ToString, 'x')) then begin
- checker := ((track2.Get(2) as TJSONObject).Get('t').JsonValue.Value);//Место
- if (ContainsText(checker, 'значение датчика')) then begin
- arr_flag[counter] := ((track2.Get(2) as TJSONObject).Get('t').JsonValue.Value);
- arr_flag[counter+1] := ((track2.Get(2) as TJSONObject).Get('y').JsonValue.Value);
- arr_flag[counter+2] := ((track2.Get(2) as TJSONObject).Get('x').JsonValue.Value);
- counter := counter+3;
- end;
- end;
- end;
- for j := 0 to (counter div 3) - 1 do begin
- if (ContainsText(arr_flag[counter1], 'значение датчика')) then begin
- if (StrToFloat(copy(arr_flag[counter1], pos( 'лось с ', arr_flag[counter1])+7, pos('т на', arr_flag[counter1]) - pos( 'лось с ', arr_flag[counter1])-8)) > StrToFloat(copy(arr_flag[counter1], pos( 'т на ', arr_flag[counter1])+5, arr_flag[counter1].Length-2 - pos( 'т на ', arr_flag[counter1])-5))) then
- begin
- Chromium1.Browser.MainFrame.ExecuteJavaScript('flagDrowFinish(' + '"' + arr_flag[counter1] + '"' + ',' + arr_flag[counter1+1] +',' + arr_flag[counter1+2] +',' + IntToStr(j+1) +')','about:blank', 0);
- counter1 := counter1 + 3;
- end
- else begin
- Chromium1.Browser.MainFrame.ExecuteJavaScript('flagDrowStart(' + '"' + arr_flag[counter1] + '"' + ',' + arr_flag[counter1+1] +',' + arr_flag[counter1+2] +',' + IntToStr(j+1) +')','about:blank', 0);
- counter1 := counter1 + 3;
- end;
- end else
- begin
- // showmessage(copy(arr_flag[counter1], pos(',', arr_flag[counter1]), pos(' т,', arr_flag[counter1])-3));
- // showmessage(copy(arr_flag[counter1], pos(' т,', arr_flag[counter1])+3, (arr_flag[counter1].Length-2 - pos(' т,', arr_flag[counter1])+3)));
- if (copy(arr_flag[counter1], pos(',', arr_flag[counter1]), pos(' т,', arr_flag[counter1])-3) > copy(arr_flag[counter1], pos(' т,', arr_flag[counter1])+3, arr_flag[counter1].Length-2 - pos(' т,', arr_flag[counter1])+3)) then begin
- Chromium1.Browser.MainFrame.ExecuteJavaScript('flagDrowFinish(' + '"' + arr_flag[counter1] + '"' + ',' + arr_flag[counter1+1] +',' + arr_flag[counter1+2] +',' + IntToStr(j+1) +')','about:blank', 0);
- counter1 := counter1 + 3;
- end else
- begin
- Chromium1.Browser.MainFrame.ExecuteJavaScript('flagDrowStart(' + '"' + arr_flag[counter1] + '"' + ',' + arr_flag[counter1+1] +',' + arr_flag[counter1+2] +',' + IntToStr(j+1) +')','about:blank', 0);
- counter1 := counter1 + 3;
- end;
- end;
- end;
- Chromium1.Browser.MainFrame.ExecuteJavaScript('update_renderer()','about:blank', 0);
- Chromium1.Browser.MainFrame.ExecuteJavaScript('show_track1(1481500800, 1486021378, 2, "C70F0F", 14643030, 52.135509491, 23.6187381744, 50.5740890503, 22.2671527863, 0x0000)','about:blank', 0);
- Chromium1.Browser.MainFrame.ExecuteJavaScript('update_renderer()','about:blank', 0);
- dynRESTreq.Params.AddItem('svc', 'report/exec_report', TRESTRequestParameterKind.pkGETorPOST); //отчет с остановками
- dynRESTreq.Params.AddItem('params', '{"reportResourceId":14464460,"reportTemplateId":13,"reportTemplate":null,"reportObjectId":14643030,"reportObjectSecId":0,"interval":{"flags":16777216,"from":1483995600,"to":1485776769}}', TRESTRequestParameterKind.pkGETorPOST);
- dynRESTreq.Params.AddItem('sid', result ,TRESTRequestParameterKind.pkGETorPOST);
- dynRESTreq.Execute;
- dynRESTreq.Params.AddItem('svc', 'report/select_result_rows', TRESTRequestParameterKind.pkGETorPOST);
- dynRESTreq.Params.AddItem('params', '{"tableIndex":0,"config":{"type":"range","data":{"from":0,"to":100,"level":0}}}', TRESTRequestParameterKind.pkGETorPOST);
- dynRESTreq.Params.AddItem('sid', result ,TRESTRequestParameterKind.pkGETorPOST);
- dynRESTreq.Execute;
- str_report := '';
- str_report := dynRESTresp.Content;
- Json1 := TJSONObject.ParseJSONValue(str_report) as TJSONArray;
- if not Assigned(JSON1) then raise Exception.Create('Файл не содержит JSON-данные');
- for i := 0 to Json1.Size-1 do begin
- track2 := ((Json1.Get(i) as TJSONObject).Get('c').JsonValue as TJSONArray);
- arr_stop[counter2] := (track2.Get(0).value);//время
- arr_stop[counter2+1] := ((track2.Get(1) as TJSONObject).Get('y').JsonValue.Value);//Y
- arr_stop[counter2+2] := ((track2.Get(1) as TJSONObject).Get('x').JsonValue.Value);//X
- counter2 := counter2 + 3;
- end;
- dynRESTreq.Params.AddItem('svc', 'report/exec_report', TRESTRequestParameterKind.pkGETorPOST); //отчет со стоянками
- dynRESTreq.Params.AddItem('params', '{"reportResourceId":14464460,"reportTemplateId":13,"reportTemplate":null,"reportObjectId":14643030,"reportObjectSecId":0,"interval":{"flags":16777216,"from":1483995600,"to":1485776769}}', TRESTRequestParameterKind.pkGETorPOST);
- dynRESTreq.Params.AddItem('sid', result ,TRESTRequestParameterKind.pkGETorPOST);
- dynRESTreq.Execute;
- dynRESTreq.Params.AddItem('svc', 'report/select_result_rows', TRESTRequestParameterKind.pkGETorPOST);
- dynRESTreq.Params.AddItem('params', '{"tableIndex":1,"config":{"type":"range","data":{"from":0,"to":100,"level":0}}}', TRESTRequestParameterKind.pkGETorPOST);
- dynRESTreq.Params.AddItem('sid', result ,TRESTRequestParameterKind.pkGETorPOST);
- dynRESTreq.Execute;
- str_report := '';
- str_report := dynRESTresp.Content;
- Json1 := TJSONObject.ParseJSONValue(str_report) as TJSONArray;
- if not Assigned(JSON1) then raise Exception.Create('Файл не содержит JSON-данные');
- for i := 0 to Json1.Size-1 do begin
- track2 := ((Json1.Get(i) as TJSONObject).Get('c').JsonValue as TJSONArray);
- arr_stop[counter2] := (track2.Get(0).value);//время
- arr_stop[counter2+1] := ((track2.Get(1) as TJSONObject).Get('y').JsonValue.Value);//Y
- arr_stop[counter2+2] := ((track2.Get(1) as TJSONObject).Get('x').JsonValue.Value);//X
- counter2 := counter2 + 3;
- end;
- for j := 0 to (counter2 div 3) - 1 do begin
- if(StrToInt(copy(arr_stop[counter3], 1, pos(':', arr_stop[counter3])-1)) < 9) then begin
- Chromium1.Browser.MainFrame.ExecuteJavaScript('stop1Drow(' + '"' + arr_stop[counter3] + '"' + ',' + arr_stop[counter3+1] +',' + arr_stop[counter3+2] +',' + IntToStr(o+1) +')','about:blank', 0);
- o := o + 1;
- end
- else if (StrToInt(copy(arr_stop[counter3], 1, pos(':', arr_stop[counter3])-1)) > 9) and (StrToInt(copy(arr_stop[counter3], 1, pos(':', arr_stop[counter3])-1)) < 24) then begin
- Chromium1.Browser.MainFrame.ExecuteJavaScript('stop2Drow(' + '"' + arr_stop[counter3] + '"' + ',' + arr_stop[counter3+1] +',' + arr_stop[counter3+2] +',' + IntToStr(p+1) +')','about:blank', 0);
- p := p + 1;
- end
- else if (StrToInt(copy(arr_stop[counter3], 1, pos(':', arr_stop[counter3])-1)) > 24) then begin
- Chromium1.Browser.MainFrame.ExecuteJavaScript('stop3Drow(' + '"' + arr_stop[counter3] + '"' + ',' + arr_stop[counter3+1] +',' + arr_stop[counter3+2] +',' + IntToStr(l+1) +')','about:blank', 0);
- l := l + 1;
- end;
- counter3 := counter3 + 3;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement