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

📄 kcsxxcx.pas

📁 《仓库管理系统》 开发语言:Delphi7.0 数据库:SQLServer2000 数据库文件:仓库管理系统_Data.MDF,仓库管理系统_Log.LDF(mingrisoft仓库管理系统Da
💻 PAS
字号:
unit kcsxxcx;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, Grids, DBGrids, Buttons, StdCtrls, DB;

type
  TForm21 = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    Label1: TLabel;
    ComboBox1: TComboBox;
    Label5: TLabel;
    SpeedButton1: TSpeedButton;
    DBGrid1: TDBGrid;
    Panel3: TPanel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    DataSource1: TDataSource;
    ComboBox2: TComboBox;
    BitBtn3: TBitBtn;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    procedure FormShow(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure BitBtn3MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure BitBtn3MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure ComboBox1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure ComboBox2KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form21: TForm21;

implementation
  uses DataModal;
{$R *.dfm}

procedure TForm21.FormShow(Sender: TObject);
begin
  ComboBox1.Clear;
  with Data.ADOQuery1 do
  begin
    Close;
    SQL.Clear;
    SQL.Add('Select distinct 商品名称 from 库存上下限表');
    Open;
  end;
  while Not Data.ADOQuery1.Eof do
  begin
    ComboBox1.Items.Add(Data.ADOQuery1.FieldByName('商品名称').Value);
    Data.ADOQuery1.Next;
  end;
end;

procedure TForm21.ComboBox1Change(Sender: TObject);
begin
  if Trim(ComboBox1.Text)<>''then
  begin
    with Data.ADOQuery1 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('select * from 库存上下限表 where 商品名称 = :a');
      Parameters.ParamByName('a').Value := Trim(ComboBox1.Text);
      Open;
    end;
    if Data.ADOQuery1.RecordCount>0 then
    begin
      ComboBox2.Clear;
      while Not Data.ADOQuery1.Eof do
      begin
        ComboBox2.Items.Add(Data.ADOQuery1.FieldByName('商品编号').Value);
        Data.ADOQuery1.Next;
      end;
    end;
    ComboBox1.SetFocus;
  end;
end;

procedure TForm21.SpeedButton1Click(Sender: TObject);
begin
  if (Trim(ComboBox1.Text)<>'')and(Trim(ComboBox2.Text)<>'')then
  begin
    with Data.ADOQuery1 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('select 库存上下限表.商品编号,库存上下限表.商品名称 ,库存上限,库存下限, 库存数量,库存金额 from 库存上下限表,库存表 where 库存上下限表.商品编号 = :a and 库存表.商品编号 = :b');
      parameters.ParamByName('a').Value := Trim(ComboBox2.Text);
      parameters.ParamByName('b').Value := Trim(ComboBox2.Text);
      Open;
    end;
    DataSource1.DataSet := Data.ADOQuery1;
    label6.Caption := IntToStr(Data.ADOQuery1.FieldByName('库存上限').Value);
    label7.Caption := IntToStr(Data.ADOQuery1.FieldByName('库存下限').Value);
    label8.Caption := IntToStr(Data.ADOQuery1.FieldByName('库存数量').Value);
    if StrToInt(label8.Caption)<= StrToInt(label7.Caption)then
      Application.MessageBox('该商品库存数量不足,请快进货。','提示',0+64);
    if StrToInt(label8.Caption)> StrToInt(label6.Caption)then
      Application.MessageBox('该商品库存数量超过上限,请停止进货。','提示',0+64);
  end;
end;

procedure TForm21.BitBtn3MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  TBitBtn(Sender).Font.Color := clRed;
end;

procedure TForm21.BitBtn3MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  TBitBtn(Sender).Font.Color := clBlue;
end;

procedure TForm21.ComboBox1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key = Vk_return then
    if Trim(ComboBox1.Text)<>'' then
    begin
      ComboBox1.OnChange(sender);
      ComboBox2.SetFocus;
    end;
end;

procedure TForm21.ComboBox2KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key = Vk_Return then
    SpeedButton1.OnClick(Sender);
end;

end.

⌨️ 快捷键说明

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