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

📄 platecompare.~pas

📁 采用Delphi7+Oracle. 该软件是由交警人员对各个路口闯红灯违法照片进行有效保存
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
      isSaveList:= TFrmSjfy1.DBGrid.Fields[4].AsString ;  //是否受保护
      isCompare:= TFrmSjfy1.DBGrid.Fields[5].AsString ;  //是否已比对
      isAvailably:= TFrmSjfy1.DBGrid.Fields[6].AsString ;  //是否有效
      onlyID:=TFrmSjfy1.DBGrid.Fields[8].AsString ; //通过onlyID,最多可查询出3张图片
      rowNum:= TFrmSjfy1.DBGrid.Fields[9].AsInteger  ;  //查询结果的序号
      dbConn.DisplayPicPhoto(onlyID,photoXH,img1,img2,img3,'0');

      if isCompare='1' then
      begin
         if isSaveList='1'  then
         begin
            if isAvailably='1' then
            begin
                  sbBar.SimpleText := '             当前照片抓拍时间:'+datetimetostr(zpsj) + '             比对结果:受保护!' +   '  该照片有效!';
            end
            else
            begin
                  sbBar.SimpleText := '             当前照片抓拍时间:'+datetimetostr(zpsj) + '             比对结果:受保护!' +   '  该照片已为被作废,视为无效!';
            end;
         end
         else
         begin
            if isAvailably='1' then
            begin
                  sbBar.SimpleText := '             当前照片抓拍时间:'+datetimetostr(zpsj)+ '            比对结果: 非保护!' +   '  该照片有效!';
            end
            else
            begin
                 sbBar.SimpleText := '             当前照片抓拍时间:'+datetimetostr(zpsj)+ '            比对结果: 非保护!'  +   '  该照片已为被作废,视为无效!';
            end;
         end;
      end
      else
      begin
                  sbBar.SimpleText := '             当前照片抓拍时间:'+datetimetostr(zpsj)+ '            未比对!';
      end;

     
end;

procedure TfrmPlateCompare.btnCompareClick(Sender: TObject);
var
  compSql:String;  //比对sql
  updateSql:String; //更新sql
begin
    ///处理无图片情况
    if img1.Picture.Bitmap.Empty and img2.Picture.Bitmap.Empty and img3.Picture.Bitmap.Empty  then
    begin
       messageBox(self.Handle, '您当前无照片,无法实现比对!','提示',MB_OK+MB_ICONINFORMATION);
       exit;
    end;
    //号牌比对
    if (cobHead.Text='') or (edtHbody.Text='')  then
    begin
       messageBox(self.Handle, '请输入完整的车牌号码!','提示',MB_OK+MB_ICONINFORMATION);
       exit;
    end;
    if cobHpzl.Text='' then
    begin
        messageBox(self.Handle, '请选择车牌种类','提示',MB_OK+MB_ICONINFORMATION);
        exit;
    end;
    compSql:='';
    compSql:='SELECT HPHM,HPZL FROM photocheck.P_SAVELIST WHERE HPHM='''+trim(cobHead.Text)+trim(edtHbody.Text)+''' AND HPZL='''+trim(getDm(cobHpzl.Text))+'''';
    if dbConn.CompareSaveList(compSql)=true then
    begin
       sbBar.SimpleText := '             比对成功,此号牌号码受保护! ';
       //更新photocheck.P_PICINFO 中的ISSAVELIST状态   :注意(为三张的图片,都要更新--可通过唯一标识别来判断)
       updateSql:='';                             //标记为保护、已比对
       updateSql:='UPDATE photocheck.P_PICINFO SET ISSAVELIST=''1'',ISCOMPARE=''1'',COMPAREDATE=to_date('''+FormatDateTime('YYYY-MM-DD HH:MM:SS',now)+''',''YYYY-MM-DD HH24:Mi:SS''),USERID='''+CurrentUserID+''' WHERE ONLYID='''+onlyID+'''';
       dbConn.Execute_SQL(updateSql);
       
    end
    else begin
       updateSql:='';                             //标记为非保护、已比对                                                     //
       updateSql:='UPDATE photocheck.P_PICINFO SET ISSAVELIST=''0'',ISCOMPARE=''1'',COMPAREDATE=to_date('''+FormatDateTime('YYYY-MM-DD HH:MM:SS',now)+''',''YYYY-MM-DD HH24:Mi:SS''),USERID='''+CurrentUserID+''' WHERE ONLYID='''+onlyID+'''';
       dbConn.Execute_SQL(updateSql);
       sbBar.SimpleText := '             比对不成功,此号牌号码非保护! ';
    end;
end;




procedure TfrmPlateCompare.TFrmSjfy1btnPriorClick(Sender: TObject);
begin
  TFrmSjfy1.btnPriorClick(Sender);

end;

procedure TfrmPlateCompare.btnPrintClick(Sender: TObject);
var
    px,py:integer;   //屏幕分辨率
    rect1,rect2,rect3:TRect;  //使用三个来分别对其 控制
    picnamewpath:string;
    fileNames:String;  //将要显示的抓拍地点和抓拍时间
begin
   ///处理无图片情况
    if img1.Picture.Bitmap.Empty and img2.Picture.Bitmap.Empty and img3.Picture.Bitmap.Empty  then
    begin
       messageBox(self.Handle, '您当前无照片,无法实现打印!','提示',MB_OK+MB_ICONINFORMATION);
       exit;
    end;

  try
      //获得打印机的分辨率
      px:=getdevicecaps(printer.Handle,logpixelsx) div PixelsPerInch;
      py:=getdevicecaps(printer.Handle,logpixelsy) div PixelsPerInch;

    //横向方向的   ,长度不能够满足
    with rect1 do   //rect1第一张图片
      begin
          left:=150;
          top:=250;
          right:=trunc(img1.Picture.Width*px*0.95)+left;
          bottom:=trunc(img1.Picture.Height*py*0.95)+top;
      end;

      with rect2 do   //rect2第二张图片
      begin
          left:=rect1.Right+1;
          top:=250 ;
          right:=trunc(img1.Picture.Width*px*0.95)+left;
          bottom:=trunc(img1.Picture.Height*py*0.95)+top;
      end;
      with rect3 do   //rect2第二张图片
      begin
          left:=rect2.Right+1;
          top:=250;
          right:=trunc(img1.Picture.Width*px*0.95)+left;
          bottom:=trunc(img1.Picture.Height*py*0.95)+top;
      end;


  //20070719星期四另外一种思路
    Printer.Orientation := polandscape;    //横向polandscape   //纵向--> poPortrait
    Printer.Title :='照片打印';

    try

        Printer.BeginDoc;

          printer.Canvas.Font.Name:='宋体';
          printer.Canvas.Font.Size := 13;
          printer.Canvas.Font.Color :=clRed;

          Printer.Canvas.StretchDraw(rect1,img1.Picture.Graphic );
          Printer.Canvas.StretchDraw(rect2,img2.Picture.Graphic );
          Printer.Canvas.StretchDraw(rect3,img3.Picture.Graphic );

       //要求显示抓拍时间与抓拍地点

          fileNames:='抓拍地点:'+zpdd+'        抓拍时间:'+datetimetostr(zpsj);
          Printer.Canvas.TextOut(rect1.Left,rect1.Bottom+8,fileNames);

          Printer.EndDoc;
          messagebox(self.Handle ,'打印成功!','打印提示',MB_OK+MB_ICONINFORMATION);
    except
        Printer.Abort ;
        raise;
    end;
  except
        messageBox(self.Handle, '请检查打印机是否正确安装!','提示',MB_OK+MB_ICONINFORMATION);
  end;

end;

procedure TfrmPlateCompare.TFrmSjfy1DBGridDrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn;
  State: TGridDrawState);
begin
  with   (Sender   as   TDBGrid)   do
  begin
  if   gdSelected   in   State   then
  begin
    Canvas.Brush.Color:=clRed;  //新颜色  clInfobk
    DefaultDrawColumnCell(rect,datacol,Column,state);
  end
  else
      Canvas.Brush.Color:=clwindow;   //默认颜色
  end;
end;

procedure TfrmPlateCompare.btnAvailablyClick(Sender: TObject);
var
  sql:String;
begin
    ///处理无图片情况
    if img1.Picture.Bitmap.Empty and img2.Picture.Bitmap.Empty and img3.Picture.Bitmap.Empty  then
    begin
       messageBox(self.Handle, '您当前无照片,无法实现操作!','提示',MB_OK+MB_ICONINFORMATION);
       exit;
    end;
    //该组照片为无效照片
    sql:='';                             //标记为无效照片                                                     //
    sql:='UPDATE photocheck.P_PICINFO SET ISAVAILABLY=''0'',ISCOMPARE=''1'',COMPAREDATE=to_date('''+FormatDateTime('YYYY-MM-DD HH:MM:SS',now)+''',''YYYY-MM-DD HH24:Mi:SS''),USERID='''+CurrentUserID+''' WHERE ONLYID='''+onlyID+'''';
    dbConn.Execute_SQL(sql);
    sbBar.SimpleText := '             已将该组照片设为无效照片状态!您的操作将被记录到数据库内! ';
end;

procedure TfrmPlateCompare.btnExportCurrentPhotoClick(Sender: TObject);
var
  saveDir:String;
  savePath:String;
begin
   ///处理无图片情况
    if img1.Picture.Bitmap.Empty and img2.Picture.Bitmap.Empty and img3.Picture.Bitmap.Empty  then
    begin
       messageBox(self.Handle, '您当前无照片,无法实现导出该组功能!','提示',MB_OK+MB_ICONINFORMATION);
       exit;
    end;
   //export current
   if   CommUnit.SelectDirectory('选择一个文件路径',   '',   saveDir,   Handle)   then
          savePath   :=   saveDir;
   if savePath<>'' then
   begin
     if dbConn.ExportPhotoFromDB(onlyID,'',savePath)=true  then
     begin
         messageBox(0,PChar('已成功将照片保存到'+savePath+'目录下!') ,'提示',MB_OK+MB_ICONINFORMATION );
     end;
   end;
end;


procedure TfrmPlateCompare.btnExportAllPhotoClick(Sender: TObject);
var
  saveDir:String;
  savePath:String;
  selSql:String;  //根据所查询的条件保存
begin
    //export all
    //export current
   if   CommUnit.SelectDirectory('选择一个文件路径',   '',   saveDir,   Handle)   then
          savePath   :=   saveDir;
   if savePath<>'' then
   begin
     selSql:=GetSQL(true);
     if dbConn.ExportPhotoFromDB('',selSql,savePath)=true then
     begin
         messageBox(0,PChar('已成功将照片保存到'+savePath+'目录下!') ,'提示',MB_OK+MB_ICONINFORMATION );
     end;
   end;
end;

end.




⌨️ 快捷键说明

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