258 lines
8.0 KiB
ObjectPascal
258 lines
8.0 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;
|
||
|
||
type
|
||
TfrmModulePromptList = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
Order_Main: TClientDataSet;
|
||
RM1: TRMGridReport;
|
||
RMDBMain: TRMDBDataSet;
|
||
RMXLSExport1: TRMXLSExport;
|
||
CDS_PRT: TClientDataSet;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1Column5: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
Label3: TLabel;
|
||
Label4: TLabel;
|
||
Label5: TLabel;
|
||
Label6: TLabel;
|
||
Label7: TLabel;
|
||
Label8: TLabel;
|
||
Label9: TLabel;
|
||
Label10: TLabel;
|
||
Label11: TLabel;
|
||
Label12: TLabel;
|
||
ModuleNote: TEdit;
|
||
Label13: TLabel;
|
||
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 FormCreate(Sender: TObject);
|
||
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
procedure ModuleNoteChange(Sender: TObject);
|
||
private
|
||
FormID,FormType:Integer;
|
||
canshu1,canshu2:string;
|
||
formFile,FormPara,Formname,FFormPara:string;
|
||
FormPara1,FormPara2,FormPara3,FormPara4,FormPara5:string;
|
||
FormPara6,FormPara7,FormPara8,FormPara9,FormPara10: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,ADOConnString: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
|
||
frmModulePromptList:=nil;
|
||
end;
|
||
|
||
procedure TfrmModulePromptList.FormClose(Sender: TObject;
|
||
var Action: TCloseAction);
|
||
begin
|
||
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
|
||
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);
|
||
ExecSQL;
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryMain,Order_Main);
|
||
SInitCDSData(ADOQueryMain,Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmModulePromptList.InitForm();
|
||
begin
|
||
FFormPara:=Trim(DConString);
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',Tv1,'<27>ҵĹܼ<C4B9>');
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmModulePromptList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
if ADOQueryMain.Active=False then Exit;
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
SCreateCDS(ADOQueryMain,Order_Main);
|
||
SInitCDSData(ADOQueryMain,Order_Main);
|
||
end;
|
||
|
||
procedure TfrmModulePromptList.FormShow(Sender: TObject);
|
||
begin
|
||
InitForm();
|
||
end;
|
||
|
||
procedure TfrmModulePromptList.cxPageControl1Change(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmModulePromptList.FormCreate(Sender: TObject);
|
||
begin
|
||
canshu1:=Trim(DParameters1);
|
||
canshu2:=Trim(DParameters2);
|
||
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(FFormPara));
|
||
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)+'''');
|
||
Open;
|
||
end;
|
||
//FormID,FormType:Integer;
|
||
// formFile,FormPara,Formname:string;
|
||
// FormPara1,FormPara2,FormPara3,FormPara4,FormPara5:string;
|
||
//FormPara6,FormPara7,FormPara8,FormPara9,FormPara10:string;
|
||
formFile:=Trim(ADOQueryTemp.fieldbyname('FormFile').AsString);
|
||
FormID:=ADOQueryTemp.fieldbyname('FormID').AsInteger;
|
||
FormType:=ADOQueryTemp.fieldbyname('FormType').AsInteger;
|
||
Formname:=Trim(ADOQueryTemp.fieldbyname('Formname').AsString);
|
||
FormPara:=Trim(ADOQueryTemp.fieldbyname('FormPara').AsString);
|
||
// ShowMessage(FormPara);
|
||
FormPara1:=Trim(ADOQueryTemp.fieldbyname('FormPara1').AsString);
|
||
FormPara2:=Trim(ADOQueryTemp.fieldbyname('FormPara2').AsString);
|
||
FormPara3:=Trim(ADOQueryTemp.fieldbyname('FormPara3').AsString);
|
||
FormPara4:=Trim(ADOQueryTemp.fieldbyname('FormPara4').AsString);
|
||
FormPara5:=Trim(ADOQueryTemp.fieldbyname('FormPara5').AsString);
|
||
FormPara6:=Trim(ADOQueryTemp.fieldbyname('FormPara6').AsString);
|
||
FormPara7:=Trim(ADOQueryTemp.fieldbyname('FormPara7').AsString);
|
||
FormPara8:=Trim(ADOQueryTemp.fieldbyname('FormPara8').AsString);
|
||
FormPara9:=Trim(ADOQueryTemp.fieldbyname('FormPara9').AsString);
|
||
FormPara10:=Trim(ADOQueryTemp.fieldbyname('FormPara10').AsString);
|
||
InitDllEvt(formFile,FormID,FormPara,FormType,Formname,FormPara1,FormPara2,
|
||
FormPara3,FormPara4,FormPara5,FormPara6,FormPara7,FormPara8,
|
||
FormPara9,FormPara10); }
|
||
end;
|
||
|
||
procedure TfrmModulePromptList.ModuleNoteChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active=False then Exit;
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
SCreateCDS(ADOQueryMain,Order_Main);
|
||
SInitCDSData(ADOQueryMain,Order_Main);
|
||
end;
|
||
|
||
end.
|