📄 inv140_01.pas.svn-base
字号:
unit Inv140_01;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Bas200_10, dxExEdtr, ActnList, DB, ADODB, Menus, dxCntner, dxTL,
dxDBCtrl, dxDBGrid, ExtCtrls, ComCtrls, ToolWin;
type
TInv140_01Form = class(TBas200_10Form)
ADOQuery1I140_001: TAutoIncField;
ADOQuery1I140_002: TWideStringField;
ADOQuery1I140_003: TWideStringField;
ADOQuery1I140_004: TSmallintField;
dxDBGrid1I140_002: TdxDBGridColumn;
dxDBGrid1I140_003: TdxDBGridColumn;
dxDBGrid1I140_004: TdxDBGridMaskColumn;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure ADOQuery1I140_004GetText(Sender: TField; var Text: String;
DisplayText: Boolean);
private
AType:array[0..5] of string;
{ Private declarations }
public
procedure SetInterface; override;
procedure InsertEvent; override;
procedure UpdateEvent; override;
procedure DeleteEvent; override;
procedure BrowseEvent; override;
procedure ReportGetValue(const ParName: String; var ParValue: Variant); override;
{ Public declarations }
end;
var
Inv140_01Form: TInv140_01Form;
implementation
uses SYSDATA, CommFun, Inv140_02;
{$R *.dfm}
procedure TInv140_01Form.SetInterface;
begin
inherited;
Caption:=GetDBString('INV14001001'); //计量单位维护
ADOQuery1I140_002.DisplayLabel:=GetDBString('INV14001002'); //单位编号
ADOQuery1I140_003.DisplayLabel:=GetDBString('INV14001003'); //单位名称
ADOQuery1I140_004.DisplayLabel:=GetDBString('INV14001004'); //单位类型
AType[0]:=GetDBString('INV14001005'); //数量单位
AType[1]:=GetDBString('INV14001006'); //重量单位
AType[2]:=GetDBString('INV14001007'); //长度单位
AType[3]:=GetDBString('INV14001008'); //面积单位
AType[4]:=GetDBString('INV14001009'); //容积单位
AType[5]:=GetDBString('INV14001010'); //时间单位
end;
procedure TInv140_01Form.FormCreate(Sender: TObject);
begin
inherited;
//
end;
procedure TInv140_01Form.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
//
end;
procedure TInv140_01Form.BrowseEvent;
begin
inherited;
ActUpdate.Execute;
end;
procedure TInv140_01Form.DeleteEvent;
var
AUnit:String;
begin
inherited;
AUnit:=ADOQuery1I140_001.AsString;
if IsExists('select 1 from INV150 where '+AUnit+' in (I150_011,I150_012,I150_014,I150_017,I150_019,I150_020)') then
begin
ShowMsg('UMS10000464'); //该计量单位被料品资料表所引用,不能删除
Abort;
end;
if IsExists('select 1 from INV145 where '+AUnit+' in (I145_003,I145_004)') then
begin
ShowMsg('UMS10000465'); //该计量单位被单位转换表所引用,不能删除
Abort;
end;
DeleteTableRecord(ADOQuery1,'INV140','I140_001='+AUnit);
end;
procedure TInv140_01Form.InsertEvent;
begin
inherited;
//新增
Inv140_02Form:=TInv140_02Form.Create(Application);
Inv140_02Form.OpenData('');
Inv140_02Form.ShowModal;
end;
procedure TInv140_01Form.ReportGetValue(const ParName: String;
var ParValue: Variant);
begin
inherited;
end;
procedure TInv140_01Form.UpdateEvent;
begin
inherited;
//修改
Inv140_02Form:=TInv140_02Form.Create(Application);
Inv140_02Form.OpenData(ADOQuery1I140_002.AsString);
Inv140_02Form.ShowModal;
end;
procedure TInv140_01Form.ADOQuery1I140_004GetText(Sender: TField;
var Text: String; DisplayText: Boolean);
begin
inherited;
if ADOQuery1.IsEmpty then Exit;
case Sender.AsInteger of
0:Text:=AType[0]; //数量单位
1:Text:=AType[1]; //重量单位
2:Text:=AType[2]; //长度单位
3:Text:=AType[3]; //面积单位
4:Text:=AType[4]; //容积单位
5:Text:=AType[5]; //时间单位
end;
end;
initialization
RegisterClass(TInv140_01Form);
finalization
UnRegisterClass(TInv140_01Form);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -