From ad92d66f48e99801998ce4fe3a79d64c8a8dc8b7 Mon Sep 17 00:00:00 2001 From: sgwp <63001967@qq.com> Date: Fri, 25 Oct 2024 09:59:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=AD=97=E6=AE=B5=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public10/ThreeFun/Fun/U_ControlData.pas | 58 +++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 public10/ThreeFun/Fun/U_ControlData.pas diff --git a/public10/ThreeFun/Fun/U_ControlData.pas b/public10/ThreeFun/Fun/U_ControlData.pas new file mode 100644 index 0000000..c93de78 --- /dev/null +++ b/public10/ThreeFun/Fun/U_ControlData.pas @@ -0,0 +1,58 @@ +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.