guolutjfrm.pas

来自「本人编写的有关军队营房工作的管理系统」· PAS 代码 · 共 194 行

PAS
194
字号
unit guolutjfrm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ImgList, Mask, DBCtrlsEh, StdCtrls, dxdbtrel, Buttons, ExtCtrls;

type
  Tguolutj = class(TForm)
    Panel2: TPanel;
    SpeedButton12: TSpeedButton;
    SpeedButton13: TSpeedButton;
    Panel1: TPanel;
    Label3: TLabel;
    Label4: TLabel;
    Label1: TLabel;
    Label2: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    Label13: TLabel;
    Label14: TLabel;
    Label15: TLabel;
    Label16: TLabel;
    dxLookupTreeView1: TdxLookupTreeView;
    Edit2: TEdit;
    ComboBox1: TComboBox;
    Edit1: TEdit;
    Edit3: TEdit;
    DBNumberEditEh1: TDBNumberEditEh;
    DBNumberEditEh2: TDBNumberEditEh;
    DBNumberEditEh3: TDBNumberEditEh;
    Edit5: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    Edit8: TEdit;
    ImageList2: TImageList;
    DBNumberEditEh4: TDBNumberEditEh;
    Label17: TLabel;
    Label18: TLabel;
    Edit4: TEdit;
    Label19: TLabel;
    Edit9: TEdit;
    Label20: TLabel;
    Edit10: TEdit;
    Label21: TLabel;
    DBNumberEditEh5: TDBNumberEditEh;
    Label22: TLabel;
    CheckBox1: TCheckBox;
    Label23: TLabel;
    Edit11: TEdit;
    Label24: TLabel;
    Edit12: TEdit;
    procedure SpeedButton13Click(Sender: TObject);
    procedure dxLookupTreeView1CloseUp(Sender: TObject; Accept: Boolean);
    procedure SpeedButton12Click(Sender: TObject);
  private
    { Private declarations }
  public
    gtj:boolean;
    { Public declarations }
  end;

var
  guolutj: Tguolutj;

implementation
uses datafrm,guolufrm;
{$R *.dfm}

procedure Tguolutj.SpeedButton13Click(Sender: TObject);
begin
close;
end;

procedure Tguolutj.dxLookupTreeView1CloseUp(Sender: TObject;
  Accept: Boolean);
var
  s_value1:string;
begin
if guolutj.dxLookupTreeView1.Text<>'' then
  begin
    guolutj.Edit2.Text:=yfgldata.dwqk.Lookup('单位代码',guolutj.dxLookupTreeView1.Text,'单位名称');
    guolutj.ComboBox1.Items.Clear;
    yfgldata.Query1.Active:=false;
    yfgldata.Query1.SQL.Clear;
    yfgldata.Query1.SQL.Add('select distinct 坐落号 ');
    yfgldata.Query1.SQL.Add(' from yfgl_yfzl ');
    yfgldata.Query1.SQL.Add(' where 单位代码='''+guolutj.dxLookupTreeView1.Text+''' ');
    try
      yfgldata.Query1.Active:=true;
    except
      messagebox(guolutj.handle,'字段值列举出错。','营房工作管理系统',16);
      exit;
    end;
    yfgldata.Query1.First;
    while not yfgldata.Query1.Eof do
    begin
      s_value1:=yfgldata.Query1.fieldbyname('坐落号').AsString;
      guolutj.ComboBox1.Items.Add(s_value1);
      yfgldata.Query1.Next;
    end;
    yfgldata.Query1.Active:=false;
  end;
end;

procedure Tguolutj.SpeedButton12Click(Sender: TObject);
begin
if guolutj.gtj then
  begin
    if guolutj.dxLookupTreeView1.Text<>'' then
      begin
        if guolutj.ComboBox1.Text<>'' then
          begin
            if guolutj.Edit1.Text<>'' then
              begin
                if guolutj.Edit3.Text<>'' then
                  begin
                    yfgldata.guolu.Append;
                    yfgldata.guolu.FieldByName('序号').AsInteger:=yfgldata.guolu.RecordCount+1;
                    yfgldata.guolu.FieldByName('单位代码').AsString:=guolutj.dxLookupTreeView1.Text;
                    yfgldata.guolu.FieldByName('住用单位').AsString:=guolutj.Edit2.Text;
                    yfgldata.guolu.FieldByName('坐落号').AsString:=guolutj.ComboBox1.Text;
                    yfgldata.guolu.FieldByName('栋号').AsString:=guolutj.Edit1.Text;
                    yfgldata.guolu.FieldByName('型号').AsString:=guolutj.Edit3.Text;
                    yfgldata.guolu.FieldByName('蒸发量').AsFloat:=guolutj.DBNumberEditEh1.Value;
                    yfgldata.guolu.FieldByName('额定压力').AsFloat:=guolutj.DBNumberEditEh2.Value;
                    yfgldata.guolu.FieldByName('使用压力').AsFloat:=guolutj.DBNumberEditEh4.Value;
                    yfgldata.guolu.FieldByName('额定温度').AsInteger:=guolutj.DBNumberEditEh3.Value;
                    yfgldata.guolu.FieldByName('燃料类型').AsString:=guolutj.Edit5.Text;
                    yfgldata.guolu.FieldByName('锅炉用途').AsString:=guolutj.Edit6.Text;
                    yfgldata.guolu.FieldByName('质量状况').AsString:=guolutj.Edit7.Text;
                    yfgldata.guolu.FieldByName('供热介质').AsString:=guolutj.Edit8.Text;
                    yfgldata.guolu.FieldByName('水处理方式').AsString:=guolutj.Edit4.Text;
                    yfgldata.guolu.FieldByName('消烟除尘方式').AsString:=guolutj.Edit9.Text;
                    yfgldata.guolu.FieldByName('生产厂家').AsString:=guolutj.Edit10.Text;
                    yfgldata.guolu.FieldByName('安装年份').AsInteger:=guolutj.DBNumberEditEh5.Value;
                    if guolutj.CheckBox1.Checked then
                      yfgldata.guolu.FieldByName('是否登记').AsString:='是'
                    else
                      yfgldata.guolu.FieldByName('是否登记').AsString:='否';
                    yfgldata.guolu.FieldByName('检验部门').AsString:=guolutj.Edit11.Text;
                    yfgldata.guolu.FieldByName('变更依据').AsString:=guolutj.Edit12.Text;
                    yfgldata.guolu.Post;
                    close;
                    guolu.showguolu;
                  end
                else
                  messagebox(guolutj.handle,'锅炉型号不能为空。','营房工作管理系统',16);
              end
            else
              messagebox(guolutj.handle,'栋号不能为空。','营房工作管理系统',16);
          end
        else
          messagebox(guolutj.handle,'坐落号不能为空。','营房工作管理系统',16);
      end
    else
      messagebox(guolutj.handle,'单位代码不能为空。','营房工作管理系统',16);
  end
else
  begin
    yfgldata.guolu.Edit;
    yfgldata.guolu.FieldByName('型号').AsString:=guolutj.Edit3.Text;
    yfgldata.guolu.FieldByName('蒸发量').AsFloat:=guolutj.DBNumberEditEh1.Value;
    yfgldata.guolu.FieldByName('额定压力').AsFloat:=guolutj.DBNumberEditEh2.Value;
    yfgldata.guolu.FieldByName('使用压力').AsFloat:=guolutj.DBNumberEditEh4.Value;
    yfgldata.guolu.FieldByName('额定温度').AsInteger:=guolutj.DBNumberEditEh3.Value;
    yfgldata.guolu.FieldByName('燃料类型').AsString:=guolutj.Edit5.Text;
    yfgldata.guolu.FieldByName('锅炉用途').AsString:=guolutj.Edit6.Text;
    yfgldata.guolu.FieldByName('质量状况').AsString:=guolutj.Edit7.Text;
    yfgldata.guolu.FieldByName('供热介质').AsString:=guolutj.Edit8.Text;
    yfgldata.guolu.FieldByName('水处理方式').AsString:=guolutj.Edit4.Text;
    yfgldata.guolu.FieldByName('消烟除尘方式').AsString:=guolutj.Edit9.Text;
    yfgldata.guolu.FieldByName('生产厂家').AsString:=guolutj.Edit10.Text;
    yfgldata.guolu.FieldByName('安装年份').AsInteger:=guolutj.DBNumberEditEh5.Value;
    if guolutj.CheckBox1.Checked then
      yfgldata.guolu.FieldByName('是否登记').AsString:='是'
    else
      yfgldata.guolu.FieldByName('是否登记').AsString:='否';
    yfgldata.guolu.FieldByName('检验部门').AsString:=guolutj.Edit11.Text;
    yfgldata.guolu.FieldByName('变更依据').AsString:=guolutj.Edit12.Text;
    yfgldata.guolu.Post;
    close;
  end;
end;

end.

⌨️ 快捷键说明

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