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

📄 qc_qcparam.pas

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

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

Type
  TFrm_Qc_QcParam = Class(TFrm_Base_Dialog)
    Label1: TLabel;
    cmbx_QcParamCode: TComboBox;
    procedure FormDestroy(Sender: TObject);
    procedure btn_okClick(Sender: TObject);
    procedure btn_CancelClick(Sender: TObject);
    procedure cmbx_QcParamCodeChange(Sender: TObject);
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Frm_Qc_QcParam: TFrm_Qc_QcParam;

implementation

{$R *.DFM}

{ TFrm_Qc_QcParam }
procedure TFrm_Qc_QcParam.FormDestroy(Sender: TObject);
begin
  inherited;
  Frm_Qc_QcParam:=nil;
end;

procedure TFrm_Qc_QcParam.btn_okClick(Sender: TObject);
var
  S,L,M:string;
  sSQL:string;
begin
  inherited;
  case cmbx_QcParamCode.Items.indexOf(cmbx_QcParamCode.text) of
    0: S:='ItemClass1';
    1: S:='ItemClass2';
    2: S:='ItemClass3';
    3: S:='ItemClass4';
    4: S:='ItemClass5';
  end;

  L:='select * from QcParam where QcParamValueC= '+ quotedstr(S);
  AdoQry_tmp.Close;
  AdoQry_tmp.SQL.clear;
  AdoQry_tmp.SQL.Add(L);
  AdoQry_tmp.Open;
  if AdoQry_tmp.RecordCount>=1 then
  begin
    Application.MessageBox('此参数已经设定,请确认后重新选择!','信息提示',MB_OK+MB_IconWArNING);
    cmbx_QcParamCode.SetFocus;
    exit;
  end
  else
  begin
    M:= 'delete QcParam where QcParamCode=''QcItemfieldName''';
    AdoQry_tmp.Close;
    AdoQry_tmp.SQL.clear;
    AdoQry_tmp.SQL.Add(M);
    AdoQry_tmp.Prepared;
    AdoQry_tmp.ExecSQL;

    sSQL:='insert into QcParam Values(''QcItemfieldName'',''质检物料分类字段名称'',0,'+quotedstr(S)+')';
    AdoQry_tmp.Close;
    AdoQry_tmp.SQL.clear;
    AdoQry_tmp.SQL.Add(sSQL);
    AdoQry_tmp.Prepared;
    AdoQry_tmp.ExecSQL;
    Application.MessageBox('参数设定完毕!','信息提示',MB_OK+MB_IconInfoRMATION);
  end;
end;

procedure TFrm_Qc_QcParam.btn_CancelClick(Sender: TObject);
begin
  inherited;
  Close;
end;

procedure TFrm_Qc_QcParam.cmbx_QcParamCodeChange(Sender: TObject);
begin
  inherited;
  if cmbx_QcParamCode.Text='请点击箭头选择' then
    btn_ok.Enabled:=False
   else
    btn_ok.Enabled:=True;  
end;

procedure TFrm_Qc_QcParam.FormActivate(Sender: TObject);
begin
  inherited;
  AdoQry_tmp.Close;
  AdoQry_tmp.SQL.clear;
  AdoQry_tmp.SQL.Add('select * from QcParam  where QcParamCode= ''QcItemfieldName''');
  AdoQry_tmp.Open;
  if AdoQry_tmp.RecordCount=0 then cmbx_QcParamCode.ItemIndex:=0
  else
  begin
    if AdoQry_tmp.fieldbyname('QcParamValueC').asstring ='ItemClass1' then
      cmbx_QcParamCode.ItemIndex:=0;
    if AdoQry_tmp.fieldbyname('QcParamValueC').asstring ='ItemClass2' then
      cmbx_QcParamCode.ItemIndex:=1;
    if AdoQry_tmp.fieldbyname('QcParamValueC').asstring ='ItemClass3' then
      cmbx_QcParamCode.ItemIndex:=2;
    if AdoQry_tmp.fieldbyname('QcParamValueC').asstring ='ItemClass4' then
      cmbx_QcParamCode.ItemIndex:=3;
    if AdoQry_tmp.fieldbyname('QcParamValueC').asstring ='ItemClass5' then
      cmbx_QcParamCode.ItemIndex:=4;
  end;
end;

end.











⌨️ 快捷键说明

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