📄 ba060.pas
字号:
unit BA060;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Simple, Db, DBTables, StdCtrls, Mask, DBCtrls, Buttons, ExtCtrls;
type
TfmBA060 = class(TfmSimple)
qyMasterCompanyID: TStringField;
qyMasterProductTypeID: TStringField;
qyMasterProductTypeName: TStringField;
qyMasterCreateMan: TStringField;
qyMasterCreateDate: TStringField;
qyMasterCreateTime: TStringField;
qyMasterModifyMan: TStringField;
qyMasterModifyDate: TStringField;
qyMasterModifyTime: TStringField;
Label1: TLabel;
Label2: TLabel;
ED2: TDBEdit;
procedure qyMasterNewRecord(DataSet: TDataSet);
procedure qyMasterBeforePost(DataSet: TDataSet);
procedure qyMasterBeforeDelete(DataSet: TDataSet);
private
{ Private declarations }
public
{ Public declarations }
procedure OpenDB; override;
end;
var
fmBA060: TfmBA060;
implementation
uses Main, DataModule, PublicFunction, CheckData;
{$R *.DFM}
{ TfmSimpleTe }
procedure TfmBA060.OpenDB;
begin
qyMaster.Close;
OrderBySQL := 'ProductTypeID';
qyMaster.SQL.Text := SQLText;
qyMaster.Open;
end;
procedure TfmBA060.qyMasterNewRecord(DataSet: TDataSet);
begin
inherited;
with qyMaster do
begin
FieldByName('ProductTypeID').AsString := Space(2);
FieldByName('ProductTypeName').AsString := Space(10);
end;
end;
procedure TfmBA060.qyMasterBeforePost(DataSet: TDataSet);
begin
inherited;
if qyMaster.State = dsInsert then
begin
if Trim(qyMaster.FieldByName('ProductTypeID').AsString) = '' then
begin
NullWarning('商品类别编码');
ED1.SetFocus;
Abort;
end;
with qyTemp do
begin
Close;
SQL.Clear;
SQL.Add('SELECT ProductTypeID ');
SQL.Add('FROM ProductType ');
SQL.Add('WHERE CompanyID = :CompanyID AND ProductTypeID = :ProductTypeID ');
ParamByName('CompanyID').AsString := sCompanyID;
ParamByName('ProductTypeID').AsString := qyMaster.FieldByName('ProductTypeID').AsString;
Open;
end;
if qyTemp.FieldByName('ProductTypeID').AsString <> '' then
begin
RepeatWarning('商品类别编码');
ED1.SetFocus;
Abort;
end;
//MyMask(qyMaster.FieldByName('ProductTypeID').AsString, '##');
end;
if Trim(qyMaster.FieldByName('ProductTypeName').AsString) = '' then
begin
NullWarning('商品类别名称!');
ED2.SetFocus;
Abort;
end;
end;
procedure TfmBA060.qyMasterBeforeDelete(DataSet: TDataSet);
begin
with qyTemp do
begin
Close;
SQL.Clear;
SQL.Add('SELECT ProductTypeID ');
SQL.Add('FROM Product ');
SQL.Add('WHERE CompanyID = :CompanyID AND ProductTypeID = :ProductTypeID ');
ParamByName('CompanyID').AsString := sCompanyID;
ParamByName('ProductTypeID').AsString := qyMaster.FieldByName('ProductTypeID').AsString;
Open;
end;
if qyTemp.FieldByName('ProductTypeID').AsString <> '' then
begin
CannotDeleteWarning('商品类别代码', qyTemp.FieldByName('ProductTypeID').AsString);
Abort;
end;
inherited;
// sPrevID := qyMaster.FieldByName('ID').AsString;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -