?? bom500_02.pas.svn-base
字號:
unit Bom500_02;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Bas200_16, DB, ADODB, Menus, StdCtrls, Buttons, ExtCtrls;
type
TBom500_02Form = class(TBas200_16Form)
qryInv150: TADOQuery;
sbEmpID: TSpeedButton;
edtEmpID: TEdit;
edtEmpName: TEdit;
lblEmpID: TLabel;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
procedure OpenData(ACode:Integer);
procedure SetInterface; override;
procedure GetDataInfo; override;
procedure SetEmptyInit; override;
procedure InsertInit; override;
procedure TableBeforePost; override;
{ Public declarations }
end;
var
Bom500_02Form: TBom500_02Form;
implementation
uses SYSDATA, CommFun;
{$R *.dfm}
procedure TBom500_02Form.OpenData(ACode:Integer);
begin
if ACode=0 then AMode:='ADD' else AMode:='UPD';
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from BOM500,INV150 where B500_002=I150_001 order by I150_002');
ADOQuery1.Open;
if ACode<>0 then
begin
ADOQuery1.Locate('B500_001',ACode,[]);
ADOQuery1AfterScroll(ADOQuery1);
end else
begin
SetEmptyInit;
end;
end;
procedure TBom500_02Form.SetInterface;
begin
inherited;
Caption:=GetDBString('BOM50002001'); //產(chǎn)品結(jié)構(gòu)維護
end;
procedure TBom500_02Form.FormCreate(Sender: TObject);
begin
inherited;
qryInv150.Open;
end;
procedure TBom500_02Form.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
qryInv150.Close;
end;
procedure TBom500_02Form.GetDataInfo;
begin
inherited;
{ edtCode.Text:=ADOQuery1.FieldByName('I100_002').AsString;
edtName.Text:=ADOQuery1.FieldByName('I100_003').AsString;
edtAddress.Text:=ADOQuery1.FieldByName('I100_004').AsString;
edtZip.Text:=ADOQuery1.FieldByName('I100_008').AsString;
cbRegion.Text:=ADOQuery1.FieldByName('O120_002').AsString;
edtPhone.Text:=ADOQuery1.FieldByName('I100_006').AsString;
edtFax.Text:=ADOQuery1.FieldByName('I100_007').AsString;
edtEmpID.Text:=ADOQuery1.FieldByName('H150_002').AsString;
edtEmpName.Text:=ADOQuery1.FieldByName('H150_003').AsString;
cbIsAllocate.Checked:=ADOQuery1.FieldByName('I100_010').Value;
cbIsMRP.Checked:=ADOQuery1.FieldByName('I100_011').Value;
AOldCode:=edtCode.Text; }
end;
procedure TBom500_02Form.InsertInit;
begin
inherited;
SetEmptyInit;
end;
procedure TBom500_02Form.SetEmptyInit;
begin
inherited;
{ edtCode.Text:='';
edtName.Text:='';
edtAddress.Text:='';
edtZip.Text:='';
cbRegion.Text:='';
edtPhone.Text:='';
edtFax.Text:='';
edtEmpID.Text:='';
edtEmpName.Text:='';
cbIsAllocate.Checked:=False;
cbIsMRP.Checked:=False;}
end;
procedure TBom500_02Form.TableBeforePost;
begin
inherited;
{ if trim(edtCode.Text)='' then
begin
ShowMsg('UMS10000439'); //倉庫編號不能為空
edtCode.SetFocus;
Abort;
end;
if trim(edtName.Text)='' then
begin
ShowMsg('UMS10000486'); //倉庫名稱不能為空
edtName.SetFocus;
Abort;
end;
if AOldCode<>trim(edtCode.Text) then
begin
if IsExists('select 1 from INV100 where I100_002='+''''+trim(edtCode.Text)+'''') then
begin
ShowMsg('UMS10000487'); //倉庫編號已存在,請重新輸入
edtCode.SetFocus;
Abort;
end;
end;
AEmpNo:=0;
if trim(edtEmpID.Text)<>'' then
begin
if not qryHrm150.Locate('H150_002',edtEmpID.Text,[]) then
begin
ShowMsg('UMS10000482'); //無效的員工編號,請重新輸入
edtEmpID.SetFocus;
Abort;
end;
AEmpNo:=qryHrm150.FieldByName('H150_001').AsInteger;
end;
if AMode='ADD' then ADOQuery1.Append else ADOQuery1.Edit;
ADOQuery1.FieldByName('I100_002').AsString:=edtCode.Text; //倉庫編號
ADOQuery1.FieldByName('I100_003').AsString:=edtName.Text; //倉庫名稱
ADOQuery1.FieldByName('I100_004').AsString:=edtAddress.Text; //倉庫地址
ADOQuery1.FieldByName('I100_008').AsString:=edtZip.Text; //郵政編碼
if cbRegion.Text<>'' then
ADOQuery1.FieldByName('I100_005').AsString:=qryOrd120.FieldByName('O120_001').Value; //所屬地區(qū)
ADOQuery1.FieldByName('I100_006').AsString:=edtPhone.Text; //電話號碼
ADOQuery1.FieldByName('I100_007').AsString:=edtFax.Text; //傳真號碼
if AEmpNo<>0 then ADOQuery1.FieldByName('I100_009').Value:=AEmpNo; //聯(lián)系人員
}
end;
{
//聯(lián)系人員查詢
if not edtEmpID.Focused then edtEmpID.SetFocus;
HwSelDataForm:=THwSelDataForm.Create(Application);
HwSelDataForm.OpenSelData(qryHrm150,nil);
if HwSelDataForm.ShowModal=1 then
begin
edtEmpID.Text:=qryHrm150.FieldByName('H150_002').AsString;
edtEmpName.Text:=qryHrm150.FieldByName('H150_003').AsString;
end;
//聯(lián)系人員
if trim(edtEmpID.Text)='' then Exit;
if qryHrm150.Locate('H150_002',edtEmpID.Text,[]) then
begin
edtEmpID.Text:=qryHrm150.FieldByName('H150_002').AsString;
edtEmpName.Text:=qryHrm150.FieldByName('H150_003').AsString;
end else
begin
ShowMsg('UMS10000482'); //無效的員工編號,請重新輸入
edtEmpID.SetFocus;
Abort;
end;
}
initialization
RegisterClass(TBom500_02Form);
finalization
UnRegisterClass(TBom500_02Form);
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -