⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 statcurve_f.~pas

📁 汽车行驶记录仪数据采集处理系统
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
begin
  pbCanvas.Left:=imgCanvas.Left+10;
  pbCanvas.Top:=imgCanvas.Top+8;
  pbCanvas.Width:=imgCanvas.Width-20;
  pbCanvas.Height:=imgCanvas.Height-18;
  px_min:=0;
  px_max:=pbCanvas.Width;
  py_min:=pbCanvas.Height;
  py_max:=0;
end;

procedure TfrmStatCurve.FormCreate(Sender: TObject);
var
  i:integer;
  strSql: String;
begin
  ADOConnection.ConnectionString := DataString;
  ADOConnection.Connected := True;
  for i:=1 to 10 do
    if (FindComponent('img' + IntToStr(i)) is TImage) and (FindComponent('pb' + IntToStr(i)) is TPaintBox) then
      SetPaintBoxPosition(TImage(FindComponent('img' + IntToStr(i))),TPaintBox(FindComponent('pb' + IntToStr(i))));
  OriginAndScale(Sender);
  for i:=1 to 10 do
    if FindComponent('img' + IntToStr(i)) is TImage then
      EstablishXYWorld(TImage(FindComponent('img' + IntToStr(i))));
  strSql:='select Car_PRovince_Type from List_Car_Province';
  ADOQuery.Active :=False;
  ADOQuery.SQL.Clear;
  ADOQuery.SQL.Add(strSql);
  ADOQuery.Open;
  for i:=0 to ADOQuery.RecordCount-1 do
  begin
    lbCarLicList.Items.Add(ADOQuery.FieldByName('Car_PRovince_Type').AsString+'-');
    ADOQuery.Next;
  end;
end;

function TfrmStatCurve.SetInfo:Boolean;
var
  strSql: string;
begin
  strSql:='select Car_ID from View_Data_AccidentDoubtful where Car_LicensePlate='''+edtCarLicense.Text+''' and Car_LicensePlateColor='''+edtLicenseColor.Text+'''';
  ADOQuery.Active :=false;
  ADOQuery.SQL.Clear;
  ADOQuery.SQL.Add(strSql);
  ADOQuery.Open;
  if ADOQuery.RecordCount=0 then
  begin
    Result:=False;
    Exit;
  end;
  strCarID:=ADOQuery.FieldByName('Car_ID').Value;
  strSql:='select Car_Code,Car_Type,Car_SpeedUpperLimit from Info_Car where Car_ID='+strCarID;
  ADOQuery.Active :=false;
  ADOQuery.SQL.Clear;
  ADOQuery.SQL.Add(strSql);
  ADOQuery.Open;
  if NOT(ADOQuery.FieldByName('Car_Code').Value=NULL) then
    edtCarID.Text:=ADOQuery.FieldByName('Car_Code').AsString;
  if NOT(ADOQuery.FieldByName('Car_Type').Value=NULL) then
    edtCarType.Text:=ADOQuery.FieldByName('Car_Type').AsString;
  if NOT(ADOQuery.FieldByName('Car_SpeedUpperLimit').Value=NULL) then
    edtMaxSpeed.Text:=ADOQuery.FieldByName('Car_SpeedUpperLimit').AsString;
  strSql:='select CarTeam_Name from View_Car_Team where Car_ID='+strCarID;
  ADOQuery.Active :=false;
  ADOQuery.SQL.Clear;
  ADOQuery.SQL.Add(strSql);
  ADOQuery.Open;
  if ADOQuery.RecordCount<>0 then
    edtCarTeam.Text:=ADOQuery.FieldByName('CarTeam_Name').Value;
  Result:=True;
end;

function TfrmStatCurve.GetData(intCurveID: integer):Boolean;
var
  strSql: string;
  i: integer;
begin
  strSql:='select AccidentDoubtful_Time,AccidentDoubtful_Speed,AccidentDoubtful_ID from View_Data_AccidentDoubtful where Car_LicensePlate='''+edtCarLicense.Text+''' and Car_LicensePlateColor='''+edtLicenseColor.Text+''' and AccidentDoubtful_CurveID='+intToStr(intCurveID)+' order by AccidentDoubtful_ID';
  ADOQuery.Close;
  ADOQuery.SQL.Clear;
  ADOQuery.SQL.Add(strSql);
  ADOQuery.Open;
  if ADOQuery.RecordCount=0 then
  begin
    Result:=False;
    Exit;
  end;
  for i:=0 to 99 do
  begin
    tmpLine[intCurveID][i].x:=ADOQuery.FieldByName('AccidentDoubtful_Time').Value;
    tmpLine[intCurveID][i].y:=ADOQuery.FieldByName('AccidentDoubtful_Speed').AsInteger div 3;
    ADOQuery.Next;
  end;
  Result:=True;
end;

procedure TfrmStatCurve.btnCloseClick(Sender: TObject);
begin
  Close;
  frmDataList.Close;
end;

procedure TfrmStatCurve.btnOKClick(Sender: TObject);
var
  i: Integer;
  strSql: String;
begin
  if SetInfo=False then
  begin
    ShowMessage('没有找到符合条件的记录');
    InitSet;
    Exit;
  end
  else
  begin
    strSql:='select AccidentDoubtful_CurveID as 曲线编号,'+
            'Car_LicensePlate as 车牌号码,'+
            'Car_Type as 车辆类型,'+
            'Driver_Licence as 驾驶证号'+
            'AccidentDoubtful_RealTime as 实时时刻,'+
            'AccidentDoubtful_Speed as 平均速度,'+
            'AccidentDoubtful_Switch as 制动信号,'+
            'AccidentDoubtful_Front as 前照大灯,'+
            'AccidentDoubtful_Night as 夜行灯,'+
            'AccidentDoubtful_Left as 左转灯,'+
            'AccidentDoubtful_Right as 右转灯,'+
            'AccidentDoubtful_Figure as 轮廓灯,'+
            'AccidentDoubtful_Sign as 近光灯,'+
            'AccidentDoubtful_Gate as 车门 FROM View_Data_AccidentDoubtful where Car_LicensePlate='''+edtCarLicense.Text+''' and Car_LicensePlateColor='''+edtLicenseColor.Text+''' order by AccidentDoubtful_ID';
    frmDataList.ADOQuery.Close;
    frmDataList.ADOQuery.SQL.Clear;
    frmDataList.ADOQuery.SQL.Add(strSql);
    frmDataList.ADOQuery.Open;
    strSql:='select AccidentDoubtful_CurveID as 曲线编号,'+
            'Car_LicensePlate as 车牌号码,'+
            'Car_Type as 车辆类型,'+
            'Driver_Licence as 驾驶证号'+
            'AccidentDoubtful_RealTime as 实时时刻,'+
            'AccidentDoubtful_Speed as 平均速度,'+
            'AccidentDoubtful_Switch as 制动信号,'+
            'AccidentDoubtful_Front as 前照大灯,'+
            'AccidentDoubtful_Night as 夜行灯,'+
            'AccidentDoubtful_Left as 左转灯,'+
            'AccidentDoubtful_Right as 右转灯,'+
            'AccidentDoubtful_Figure as 轮廓灯,'+
            'AccidentDoubtful_Sign as 近光灯,'+
            'AccidentDoubtful_Gate as 车门 FROM View_Data_AccidentDoubtful where Car_LicensePlate='''+edtCarLicense.Text+''' and Car_LicensePlateColor='''+edtLicenseColor.Text+''' and AccidentDoubtful_Speed>'+edtMaxSpeed.Text+' order by AccidentDoubtful_ID';
    frmDataList.ADOQueryUp.Close;
    frmDataList.ADOQueryUp.SQL.Clear;
    frmDataList.ADOQueryUp.SQL.Add(strSql);
    frmDataList.ADOQueryUp.Open;
    pb1.Enabled:=True;
    pb2.Enabled:=True;
    pb3.Enabled:=True;
    pb4.Enabled:=True;
    pb5.Enabled:=True;
    pb6.Enabled:=True;
    pb7.Enabled:=True;
    pb8.Enabled:=True;
    pb9.Enabled:=True;
    pb10.Enabled:=True;
  end;
  for i:=1 to 10 do
  begin
    if GetData(i)=False then
    begin
      ShowMessage('没有找到数据资料');
      arrCurveSign[i]:=1;
      Continue;
      //Exit;
    end;
    if FindComponent('pb' + IntToStr(i)) is TPaintBox then
      pPolyline(tmpLine,i,100,TPaintBox(FindComponent('pb' + IntToStr(i))));
  end;
end;

procedure TfrmStatCurve.pb1Paint(Sender: TObject);
begin
  if rePaintType=mRePaint then
    pPolyline(tmpLine,1,100,pb1);
end;

procedure TfrmStatCurve.pb2Paint(Sender: TObject);
begin
  if rePaintType=mRePaint then
    pPolyline(tmpLine,2,100,pb2);
end;

procedure TfrmStatCurve.pb3Paint(Sender: TObject);
begin
  if rePaintType=mRePaint then
    pPolyline(tmpLine,3,100,pb3);
end;

procedure TfrmStatCurve.pb4Paint(Sender: TObject);
begin
  if rePaintType=mRePaint then
    pPolyline(tmpLine,4,100,pb4);
end;

procedure TfrmStatCurve.pb5Paint(Sender: TObject);
begin
  if rePaintType=mRePaint then
    pPolyline(tmpLine,5,100,pb5);
end;

procedure TfrmStatCurve.pb6Paint(Sender: TObject);
begin
  if rePaintType=mRePaint then
    pPolyline(tmpLine,6,100,pb6);
end;

procedure TfrmStatCurve.pb7Paint(Sender: TObject);
begin
  if rePaintType=mRePaint then
    pPolyline(tmpLine,7,100,pb7);
end;

procedure TfrmStatCurve.pb8Paint(Sender: TObject);
begin
  if rePaintType=mRePaint then
    pPolyline(tmpLine,8,100,pb8);
end;

procedure TfrmStatCurve.pb9Paint(Sender: TObject);
begin
  if rePaintType=mRePaint then
    pPolyline(tmpLine,9,100,pb9);
end;

procedure TfrmStatCurve.pb10Paint(Sender: TObject);
begin
  if rePaintType=mRePaint then
    pPolyline(tmpLine,10,100,pb10);
end;

procedure TfrmStatCurve.btnSelectClick(Sender: TObject);
var
  TempCOM: Variant;
begin
  TempCOM := CreateComObject(StringToGUID('{8EFBB15C-44B7-49BF-8529-F35147FAD8A4}')) as IDispatch;
  edtLicenseColor.Text := TempCOM.MMInvoke('','','',DataString);
end;

procedure TfrmStatCurve.InitSet;
var
  i: Integer;
begin
  rePaintType:=mNoPaint;
  pb1.Refresh;
  pb2.Refresh;
  pb3.Refresh;
  pb4.Refresh;
  pb5.Refresh;
  pb6.Refresh;
  pb7.Refresh;
  pb8.Refresh;
  pb9.Refresh;
  pb10.Refresh;
  edtCarID.Text:='';
  edtCarTeam.Text:='';
  edtCarType.Text:='';
  edtMaxSpeed.Text:='';
  pb1.Enabled:=False;
  pb2.Enabled:=False;
  pb3.Enabled:=False;
  pb4.Enabled:=False;
  pb5.Enabled:=False;
  pb6.Enabled:=False;
  pb7.Enabled:=False;
  pb8.Enabled:=False;
  pb9.Enabled:=False;
  pb10.Enabled:=False;
  for i:=1 to 10 do
   arrCurveSign[i]:=0;
end;

procedure TfrmStatCurve.btnDataListClick(Sender: TObject);
begin
  frmDataList.Show;
end;

procedure TfrmStatCurve.edtCarLicenseDblClick(Sender: TObject);
begin
  lbCarLicList.Visible:=True;  
end;

procedure TfrmStatCurve.lbCarLicListClick(Sender: TObject);
var
  lbindex: Integer;
begin
  for lbindex:=0 to lbCarLicList.Items.Count-1 do
  begin
    if lbCarLicList.Selected[lbindex] then
      Break;
  end;
  edtCarLicense.Text:=lbCarLicList.Items.Strings[lbindex];
  lbCarLicList.Visible:=False;
end;

procedure TfrmStatCurve.FormShow(Sender: TObject);
begin
  InitSet;
end;

procedure TfrmStatCurve.edtCarLicenseKeyPress(Sender: TObject;
  var Key: Char);
begin
  if key=#97 then                      //a
    key:=#65;                          //A
  if key=#98 then                      //b
    key:=#66;                          //B
  if key=#99 then                      //c
    key:=#67;                          //C
  if key=#100 then                     //d
    key:=#68;                          //D
  if key=#101 then                     //e
    key:=#69;                          //E
  if key=#102 then                     //f
    key:=#70;                          //F
  if key=#103 then                     //g
    key:=#71;                          //G
  if key=#104 then                     //h
    key:=#72;                          //H
  if key=#105 then                     //i
    key:=#73;                          //I
  if key=#106 then                     //j
    key:=#74;                          //J
  if key=#107 then                     //k
    key:=#75;                          //K
  if key=#108 then                     //l
    key:=#76;                          //L
  if key=#109 then                     //m
    key:=#77;                          //M
  if key=#110 then                     //n
    key:=#78;                          //N
  if key=#111 then                     //o
    key:=#79;                          //O
  if key=#112 then                     //p
    key:=#80;                          //P
  if key=#113 then                     //q
    key:=#81;                          //Q
  if key=#114 then                     //r
    key:=#82;                          //R
  if key=#115 then                     //s
    key:=#83;                          //S
  if key=#116 then                     //t
    key:=#84;                          //T
  if key=#117 then                     //u
    key:=#85;                          //U
  if key=#118 then                     //v
    key:=#86;                          //V
  if key=#119 then                     //w
    key:=#87;                          //W
  if key=#120 then                     //x
    key:=#88;                          //X
  if key=#121 then                     //y
    key:=#89;                          //Y
  if key=#122 then                     //z
    key:=#90;                          //Z
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -