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

📄 qc_qcproblem_d.pas

📁 一个MRPII系统源代码版本
💻 PAS
字号:
unit Qc_QcProblem_D;
//
Interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Base_Detail, Db, AdODB, ExtCtrls, StdCtrls, ExtEdit;

Type
  TFrm_Qc_QcProblem_D = Class(TFrm_Base_Detail)
    Extedt_Code: TExtEdit;
    Extedt_Name: TExtEdit;
    Label1: TLabel;
    Label2: TLabel;
    procedure FormDestroy(Sender: TObject);
    procedure btn_okClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure InitControls; Override;
    procedure SaveData; Override;
  end;

var
  Frm_Qc_QcProblem_D: TFrm_Qc_QcProblem_D;

implementation
uses Sys_Global;
{$R *.DFM}

procedure TFrm_Qc_QcProblem_D.FormDestroy(Sender: TObject);
begin
  inherited;
  Frm_Qc_QcProblem_D:=nil;
end;

procedure TFrm_Qc_QcProblem_D.InitControls;
begin
  inherited;
  with AdoQry_Maintain do
  begin
    Extedt_Code.Text:=fieldbyname('QcProblemCode').AsString;
    Extedt_Name.Text:=fieldbyname('QcProblemDecription').AsString;
  end;
end;

procedure TFrm_Qc_QcProblem_D.SaveData;
begin
  inherited;
  if(Add)then
  begin
    with AdoQry_tmp do
    begin
      Close;
      SQL.clear;
      SQL.Text:='Insert into QcProblem(QcProblemCode,QcProblemDecription)'
        +' Values('
        +' '''+Extedt_Code.Text+''''
        +','''+ExtEdt_Name.Text+''''
        +')';
      ExecSQL;
    end;
  end
  else
  begin
    with AdoQry_tmp do
    begin
      Close;
      SQL.clear;
      SQL.Text:='Update QcProblem'
        +' Set QcProblemCode='''+Extedt_Code.Text+''''
        +',QcProblemDecription='''+ExtEdt_Name.Text+''''
        +' Where QcProblemCode='''+AdoQry_Maintain.fieldbyname('QcProblemCode').AsString+'''';
      ExecSQL;
    end;
  end;

  with AdoQry_Maintain do
  begin
    fieldbyname('QcProblemCode').AsString:=Extedt_Code.Text;
    fieldbyname('QcProblemDecription').AsString:=Extedt_Name.Text;
    Post;
  end;
end;

procedure TFrm_Qc_QcProblem_D.btn_okClick(Sender: TObject);
var
  S:string;
begin
  if (Add) then
  begin
    S:= 'select * from QcProblem where QcProblemCode='+quotedstr(Extedt_Code.text);
    AdoQry_tmp.Close;
    AdoQry_tmp.SQL.clear;
    AdoQry_tmp.SQL.Add(S);
    AdoQry_tmp.Open;
    if AdoQry_tmp.RecordCount>=1 then
    begin
      Application.MessageBox('此代码已存在,请确认后输入','信息提示',MB_OK+MB_IconInfoRMATION);
      Extedt_Code.SetFocus;
      exit;
    end;
  end;
  inherited;
  if (Add) then
  begin
    Extedt_Code.Text:='';
    Extedt_Name.Text:='';
    Extedt_Code.SetFocus;
  end;
end;

end.

⌨️ 快捷键说明

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