RTFormwork/public10/ThreeFun/Fun/U_ControlData.pas
2024-10-25 09:59:51 +08:00

59 lines
1.7 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_ControlData;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolWin, ShlObj, cxShellCommon, cxControls, cxDropDownEdit,
cxContainer, cxShellTreeView, cxShellListView, StdCtrls, BtnEdit,
OleCtnrs, DB, ADODB,ZLib;
function InitDevCombobox(ADOQueryTmp: TADOQuery; combobox: TcxCombobox; mFlag: string; selFlag:Boolean=true): Boolean;
implementation
/// ////////////////////////////////////////////////
// 函数功能:取流水号
// mFlag:前缀mTable:表名
// mlen:流水号长度; mtype:是否带日期 1带 0 不带
/// ////////////////////////////////////////////////
function InitDevCombobox(ADOQueryTmp: TADOQuery; combobox: TcxCombobox; mFlag: string; selFlag:Boolean=true): Boolean;
begin
Result := false;
try
with ADOQueryTmp do
begin
close;
sql.Clear;
sql.Add('select a.itemText from SY_Dict_Item a');
sql.Add(' inner join SY_Dict b on b.dictId=a.dictId');
sql.Add(' where b.dictcode='+QuotedStr(mFlag));
sql.Add('and a.valid=1 and b.valid=1');
sql.Add('order by b.sortorder');
Open;
if IsEmpty then
begin
application.MessageBox(PWideChar('未定义等级对应的字段字典数据(' + mFlag + ')'),'',0);
Exit;
end;
combobox.Properties.Items.Clear;
first;
while not eof do
begin
combobox.Properties.Items.Add(trim(FieldByName('itemText').AsString));
next;
end;
if selFlag and (combobox.Properties.Items.Count>0) then
begin
combobox.ItemIndex:=0;
end;
end;
except
raise Exception.Create(PWideChar('获取等级字段字典数据(' + mFlag + ')时,发生错误!'));
end;
end;
end.