📄 inv_whselect.pas
字号:
unit Inv_WhSelect;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Dialog, StdCtrls, Db, AdODB;
Type
TFrm_Inv_WhSelect = Class(TFrm_Base_Dialog)
LstBx_WhSelect: TListBox;
procedure btn_okClick(Sender: TObject);
private
{ Private declarations }
public
selectwhCode,selectwhCodeName:string;
function initform(tmp_Cnnction:tAdoConnection;uid:string):boolean;
{ Public declarations }
end;
var
Frm_Inv_WhSelect: TFrm_Inv_WhSelect;
implementation
uses Sys_Global;
{$R *.DFM}
function TFrm_Inv_WhSelect.initform(tmp_Cnnction:tAdoConnection;uid:string):boolean;
begin
with AdoQry_tmp do
begin
Connection:=tmp_Cnnction;
Close;
sql.clear;
sql.Add('select w.whCode,w.whName from Warehouse w,whAccessCtrl a where a.EmployeeCode='''+uid+''' and w.whCode=a.whCode ');
open;
if eof then
begin
DispInfo('该用户没有仓库控制权!',1);
Result:=False;
end
else
begin
LstBx_WhSelect.clear;
First;
while not eof do
begin
LstBx_WhSelect.Items.Add(fieldbyname('whCode').asstring+' '+fieldbyname('whName').asstring);
next;
end;
Result:=True;
end;
end;
end;
procedure TFrm_Inv_WhSelect.btn_okClick(Sender: TObject);
var
M:integer;
begin
inherited;
with LstBx_WhSelect do
begin
if LstBx_WhSelect.SelCount=0 then
begin
DispInfo('没有选择仓库!',1);
abort;
end;
selectwhCode:='';
for M:=0 to LstBx_WhSelect.Items.Count-1 do
begin
if LstBx_WhSelect.Selected[M] then
begin
if selectwhCode='' then
begin
selectwhCode:=''''+getCode(lstbx_Whselect.Items.Strings[M])+'''';
selectwhCodeName:=Trim(lstbx_Whselect.Items.Strings[M]);
end
else
begin
selectwhCode:=selectwhCode+','''+getCode(lstbx_Whselect.Items.Strings[M])+'''';
selectwhCodeName:=selectwhCodeName+','+Trim(lstbx_Whselect.Items.Strings[M]);
end;
end;
end;
selectwhCode:=' where whCode in ('+selectwhCode+')';
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -