183 lines
6.4 KiB
ObjectPascal
183 lines
6.4 KiB
ObjectPascal
unit U_ModulePromptList;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
||
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses, cxControls,
|
||
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
||
cxGrid, DBClient, cxCalendar, cxButtonEdit, cxSplitter, RM_Common, RM_Class,
|
||
RM_e_Xls, RM_Dataset, RM_System, RM_GridReport, cxTextEdit, cxPC,
|
||
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore,
|
||
dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, U_BaseList;
|
||
|
||
type
|
||
TfrmModulePromptList = class(TfrmBaseList)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
Order_Main: TClientDataSet;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1Column5: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
v1Column1: TcxGridDBColumn;
|
||
Panel2: TPanel;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure cxPageControl1Change(Sender: TObject);
|
||
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
private
|
||
fDConString_link1: string;
|
||
procedure InitGrid();
|
||
procedure InitForm();
|
||
procedure InitDllEvt(FromFile: string; FormID: Integer; Para: string; FormType: Integer; Title: string; Def1: string; Def2: string; Def3: string; Def4: string; Def5: string; Def6: string; Def7: string; Def8: string; Def9: string; Def10: string);
|
||
{ Private declarations }
|
||
public
|
||
{ Public declarations }
|
||
userID, username: string;
|
||
end;
|
||
|
||
var
|
||
frmModulePromptList: TfrmModulePromptList;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun;
|
||
|
||
type
|
||
TMyF = function(App: TApplication; //<2F><>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD> (<28><>Delphi<68><69><EFBFBD><EFBFBD>)
|
||
FormH: HWND; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵĸ<DAB5><C4B8><EFBFBD><EFBFBD>ھ<EFBFBD><DABE><EFBFBD> (<28><>PB<50><42><EFBFBD><EFBFBD>)
|
||
FormID: Integer; //Ҫ<><D2AA><EFBFBD><EFBFBD>dll<6C>й<EFBFBD><D0B9>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD><EFBFBD>Id<49><64>; <20><><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4>ڣ<EFBFBD>FormIDĬ<44><C4AC>Ϊ0
|
||
Language: Integer; //0=Delphi; 1=PB
|
||
WinStyle: Integer; //0=<3D>Ӵ<EFBFBD><D3B4><EFBFBD>; 1<><31><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD> (PB<50>ж<EFBFBD>Ϊ<EFBFBD><CEAA>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>)
|
||
UID: PChar; //<2F>û<EFBFBD>Id
|
||
UName: PChar; //<2F>û<EFBFBD><C3BB><EFBFBD>
|
||
Para: PChar; Title: PChar; Defstr1: PChar; Defstr2: PChar; Defstr3: PChar; Defstr4: PChar; Defstr5: PChar; Defstr6: PChar; Defstr7: PChar; Defstr8: PChar; Defstr9: PChar; Defstr10: PChar; Datalink: PChar): HWND; stdcall;
|
||
|
||
var
|
||
TP: FARPROC;
|
||
Tf: TMyF;
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmModulePromptList.FormDestroy(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
frmModulePromptList := nil;
|
||
end;
|
||
|
||
procedure TfrmModulePromptList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmModulePromptList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', Tv1, '<27>ҵĹܼ<C4B9>');
|
||
end;
|
||
|
||
procedure TfrmModulePromptList.InitGrid();
|
||
begin
|
||
try
|
||
//DCode:='ADMIN';
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add(' exec P_Chk_Tishi :DName,:DCode');
|
||
Parameters.ParamByName('DName').Value := Trim(DName);
|
||
Parameters.ParamByName('DCode').Value := Trim(DCode);
|
||
//ShowMessage(DName+DCode);
|
||
ExecSQL;
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryMain, Order_Main);
|
||
SInitCDSData(ADOQueryMain, Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmModulePromptList.InitForm();
|
||
begin
|
||
fDConString_link1 := Trim(DConString);
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>', Tv1, '<27>ҵĹܼ<C4B9>');
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmModulePromptList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmModulePromptList.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
InitForm();
|
||
end;
|
||
|
||
procedure TfrmModulePromptList.cxPageControl1Change(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmModulePromptList.InitDllEvt(FromFile: string; FormID: Integer; Para: string; FormType: Integer; Title: string; Def1: string; Def2: string; Def3: string; Def4: string; Def5: string; Def6: string; Def7: string; Def8: string; Def9: string; Def10: string);
|
||
var
|
||
Th: HMODULE;
|
||
begin
|
||
Th := LoadLibrary(PChar(FromFile));
|
||
if Th > 0 then
|
||
begin
|
||
TP := GetProcAddress(Th, 'GetDllForm');
|
||
if TP <> nil then
|
||
begin
|
||
Tf := TMyF(Tp);
|
||
Tf(Application, 0, FormID, 0, FormType, PChar(DCode), PChar(DName), PChar(Para), PChar(Title), PChar(Def1), PChar(Def2), PChar(Def3), PChar(Def4), PChar(Def5), PChar(Def6), PChar(Def7), PChar(Def8), PChar(Def9), PChar(Def10), pchar(fDConString_link1));
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('<27><EFBFBD><F2B2BBBF>ļ<EFBFBD>' + FromFile + '<27><>'), '<27><><EFBFBD><EFBFBD>', MB_ICONERROR);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmModulePromptList.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from SY_ModuleSub where ModuleId=''' + Trim(Order_Main.fieldbyname('ModuleId').AsString) + '''');
|
||
sql.Add(' and ModuleSubId=''' + Trim(Order_Main.fieldbyname('ModuleSubId').AsString) + '''');
|
||
// ShowMessage(SQL.Text);
|
||
Open;
|
||
end;
|
||
|
||
if not ADOQueryTemp.IsEmpty then
|
||
begin
|
||
InitDllEvt(Trim(ADOQueryTemp.FieldByName('formFile').AsString), ADOQueryTemp.FieldByName('FormID').AsInteger, Trim(ADOQueryTemp.FieldByName('FormPara').AsString), ADOQueryTemp.FieldByName('FormType').AsInteger, Trim(ADOQueryTemp.FieldByName('Formname').AsString), Trim(ADOQueryTemp.FieldByName('FormPara1').AsString), Trim(ADOQueryTemp.FieldByName('FormPara2').AsString), Trim(ADOQueryTemp.FieldByName('FormPara3').AsString), Trim(ADOQueryTemp.FieldByName('FormPara4').AsString), Trim(ADOQueryTemp.FieldByName
|
||
('FormPara5').AsString), Trim(ADOQueryTemp.FieldByName('FormPara6').AsString), Trim(ADOQueryTemp.FieldByName('FormPara7').AsString), Trim(ADOQueryTemp.FieldByName('FormPara8').AsString), Trim(ADOQueryTemp.FieldByName('FormPara9').AsString), Trim(ADOQueryTemp.FieldByName('FormPara10').AsString));
|
||
end;
|
||
|
||
end;
|
||
|
||
end.
|
||
|