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

📄 unperselplan.pas

📁 设备巡检操作系统 本程序是专门为某电厂开发的设备巡检系统
💻 PAS
字号:
unit UnPerSelPlan;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, CheckLst, Buttons,Db,Adodb;

type
  TFrm_PerSelPlan = class(TForm)
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    ListBox1: TListBox;
    procedure FormCreate(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Frm_PerSelPlan: TFrm_PerSelPlan;

implementation

uses Undm, UnFuntion;

{$R *.dfm}

procedure TFrm_PerSelPlan.FormCreate(Sender: TObject);
var
  adoqSPlan:TADOQuery;
  strPlan:string;
  ls:TStrings;
  i:integer;
begin
  ListBox1.Clear;
  ls:=TStringList.Create;
  Top:=50;Left:=206;Width:=239;Height:=256;
  adoqSPlan:=TADOQuery.Create(nil);
  try
  With adoqSPlan do
  begin
    Connection:=DM.AdoConn;
    SQL.Text:='SELECT * from T_employee where no='+quotedstr(copy(UserName,1,4));
    Open;
    if not eof then
      strPlan:=fieldbyname('planno').AsString;
    Close;
    SQL.Text:='select distinct T_PerPlan.planNo from T_PerPlan,T_employee where t_employee.no='+quotedstr(copy(UserName,1,4)) +' and T_PerPlan.specialty=T_employee.deptno order by PlanNo';
    Open;
    while not eof do
    begin
      ls.Add('DJ'+fieldbyname('PlanNo').AsString);
      Next;
    end;
  end;
    if ls.Count>0 then begin
     i:=ls.IndexOf('DJ'+strPlan);
      ListBox1.Items.Assign(ls);
      ListBox1.ItemIndex:=i;
    end;
  finally
    ls.Free;
    adoqSPlan.Free;
  end;



end;

procedure TFrm_PerSelPlan.BitBtn2Click(Sender: TObject);
begin
  Close;
end;

procedure TFrm_PerSelPlan.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  Action:=cafree;Frm_PerSelPlan:=nil;
end;

procedure TFrm_PerSelPlan.BitBtn1Click(Sender: TObject);
var
  adoqSPlan:TADOQuery;
  tmps:string;
begin
  if ListBox1.ItemIndex=-1 then exit;
  tmps:=copy(ListBox1.Items[ListBox1.itemindex],3,9);
  adoqSPlan:=TADOQuery.Create(nil);
  try
  With adoqSPlan do
  begin
    Connection:=DM.AdoConn;
    SQl.Text:='update T_employee set planno='+quotedstr(tmps)+' where no='+quotedstr(copy(username,1,4));
    ExecSQL;
  end;
  finally
    Close;
    Free;
  end;
end;

end.

⌨️ 快捷键说明

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