579 lines
16 KiB
ObjectPascal
579 lines
16 KiB
ObjectPascal
unit U_GetDllForm;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, forms, OleCtnrs, DateUtils, SysUtils, ADODB, IniFiles,
|
||
dxCore, ActiveX;
|
||
|
||
function GetDllForm(App: Tapplication; FormH: hwnd; FormID: integer; Language: integer; WinStyle: integer; GCode: Pchar; GName: Pchar; DataBase: Pchar; Title: PChar; Parameters1: PChar; Parameters2: PChar; Parameters3: PChar; Parameters4: PChar; Parameters5: PChar; Parameters6: PChar; Parameters7: PChar; Parameters8: PChar; Parameters9: PChar; Parameters10: PChar; DataBaseStr: PChar): hwnd; export; stdcall;
|
||
|
||
function ConnData(): Boolean;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_Fun, U_YFCR, U_FKCR, U_YFFKList, U_YSCR, U_SKCR, U_YSSKList,
|
||
U_YSCRJZC, U_YSCR_Gd, U_SKCR_Gd, U_YFZDList_MX, U_YSZDList_MX, U_YFMXlist,
|
||
U_YSMXlist, U_YFCRMXList, U_FDINVOICE, U_FPINVOICE_TJ, U_FDINVOICE_X,
|
||
U_FDINVOICE_XMX, U_FDINVOICE_S, U_YF_Money_LL, U_YF_Money_LL_list,
|
||
U_XXFPINVOICE_TJ, U_CostCR, U_YSCRMXList, U_FDINVOICE_JMX, U_YFZZCR;
|
||
|
||
/////////////////////////////////////////////////////////////////
|
||
// 功能说明:取Dll中得窗体 //
|
||
// 参数说明:App>>调用应用程序; //
|
||
// FormH>>调用窗口句柄 ; //
|
||
// FormID>>窗口号; //
|
||
// Language>>语言种类; //
|
||
// WinStyle>>窗口类型; //
|
||
/////////////////////////////////////////////////////////////////
|
||
function GetDllForm(App: Tapplication; FormH: hwnd; FormID: integer; Language: integer; WinStyle: integer; GCode: Pchar; GName: Pchar; DataBase: Pchar; Title: PChar; Parameters1: PChar; Parameters2: PChar; Parameters3: PChar; Parameters4: PChar; Parameters5: PChar; Parameters6: PChar; Parameters7: PChar; Parameters8: PChar; Parameters9: PChar; Parameters10: PChar; DataBaseStr: PChar): hwnd;
|
||
var
|
||
mnewHandle: hwnd;
|
||
mstyle: TFormStyle; // 0:子窗口; 1:普通窗口
|
||
mstate: TWindowState;
|
||
mborderstyle: TFormBorderStyle;
|
||
begin
|
||
mnewHandle := 0;
|
||
DName := GName;
|
||
DCode := GCode;
|
||
DdataBase := DataBase;
|
||
DTitCaption := Title;
|
||
DParameters1 := Parameters1;
|
||
DParameters2 := Parameters2;
|
||
DParameters3 := Parameters3;
|
||
DParameters4 := Parameters4;
|
||
DParameters5 := Parameters5;
|
||
DParameters6 := Parameters6;
|
||
DParameters7 := Parameters7;
|
||
DParameters8 := Parameters8;
|
||
DParameters9 := Parameters9;
|
||
DParameters10 := Parameters10;
|
||
|
||
MainApplication := App;
|
||
DCurHandle := FormH;
|
||
IsDelphiLanguage := Language;
|
||
|
||
Application := TApplication(App);
|
||
DCurHandle := 0;
|
||
|
||
|
||
//赋值链接字符串
|
||
SetLength(server, 255);
|
||
SetLength(dtbase, 255);
|
||
SetLength(user, 255);
|
||
SetLength(pswd, 255);
|
||
|
||
if Trim(DataBaseStr) = '' then
|
||
begin
|
||
server := '101.132.143.144,7781';
|
||
// server := '.';
|
||
dtbase := 'chenfengdata';
|
||
user := 'rtsa';
|
||
pswd := 'rightsoft@5740';
|
||
DConString := 'Provider=SQLOLEDB.1;Password=' + pswd + ';Persist Security Info=True;User ID=' + user + ';Initial Catalog=' + dtbase + ';Data Source=' + server;
|
||
// Parameters2 := '织造';
|
||
end
|
||
else
|
||
DConString := DataBaseStr;
|
||
// DName:='ADMIN';
|
||
// DParameters1:='高权限';
|
||
//Parameters1:='高权限';
|
||
|
||
if not ConnData() then
|
||
begin
|
||
result := 0;
|
||
exit;
|
||
end;
|
||
{ if IsINIFile() then
|
||
ReadINIFile()
|
||
else
|
||
WriteINIFile ;}
|
||
// 定义窗口类型 、状态
|
||
if WinStyle = 0 then
|
||
begin
|
||
mstyle := fsMDIChild;
|
||
mstate := wsMaximized;
|
||
mborderstyle := bsSizeable;
|
||
end
|
||
else
|
||
begin
|
||
mstyle := fsNormal;
|
||
mstate := wsNormal;
|
||
mborderstyle := bsSizeable;
|
||
end;
|
||
////////////////////
|
||
{ GetSWLDZ('192.168.1.246');
|
||
if IpCall<>0 then
|
||
begin
|
||
Result:=0;
|
||
Application.MessageBox('!!网络不通!!','提示',0);
|
||
Exit;
|
||
end;
|
||
if Trim(IpWLDZStr)<>'D4:AE:52:BE:9F:02' then
|
||
begin
|
||
Result:=0;
|
||
Application.MessageBox('!!数据库连接失败!!','提示',0);
|
||
Exit;
|
||
end; }
|
||
/////////////////////
|
||
//调用子模块窗口
|
||
case FormID of
|
||
11: //应付款织造登记
|
||
begin
|
||
if frmYFZZCR = nil then
|
||
begin
|
||
frmYFZZCR := TfrmYFZZCR.Create(application.MainForm);
|
||
with frmYFZZCR do
|
||
begin
|
||
caption := Trim(Title);
|
||
fmanage := trim(Parameters1);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYFZZCR.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYFZZCR.Handle;
|
||
end;
|
||
|
||
111: //应付款登记
|
||
begin
|
||
if frmYFCR = nil then
|
||
begin
|
||
frmYFCR := TfrmYFCR.Create(application.MainForm);
|
||
with frmYFCR do
|
||
begin
|
||
caption := Trim(Title);
|
||
fmanage := trim(Parameters1);
|
||
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYFCR.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYFCR.Handle;
|
||
end;
|
||
112: //应付款明细查询
|
||
begin
|
||
if frmYFCRMXList = nil then
|
||
begin
|
||
frmYFCRMXList := TfrmYFCRMXList.Create(application.MainForm);
|
||
with frmYFCRMXList do
|
||
begin
|
||
fmanage := trim(Parameters1);
|
||
CANSHU1 := trim(Parameters2);
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYFCRMXList.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYFCRMXList.Handle;
|
||
end;
|
||
121: //付款登记
|
||
begin
|
||
if frmFKCR = nil then
|
||
begin
|
||
frmFKCR := TfrmFKCR.Create(application.MainForm);
|
||
with frmFKCR do
|
||
begin
|
||
caption := Trim(Title);
|
||
CANSHU1 := trim(Parameters2);
|
||
fmanage := trim(Parameters1);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmFKCR.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmFKCR.Handle;
|
||
end;
|
||
|
||
131: //应付款付款统计
|
||
begin
|
||
if frmYFFKList = nil then
|
||
begin
|
||
frmYFFKList := TfrmYFFKList.Create(application.MainForm);
|
||
with frmYFFKList do
|
||
begin
|
||
caption := Trim(Title);
|
||
CANSHU1 := trim(Parameters2);
|
||
fDParameters1 := trim(DParameters1);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYFFKList.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYFFKList.Handle;
|
||
end;
|
||
141: //应付对账单
|
||
begin
|
||
if frmYFMXlist = nil then
|
||
begin
|
||
frmYFMXlist := TfrmYFMXlist.Create(application.MainForm);
|
||
with frmYFMXlist do
|
||
begin
|
||
caption := Trim(Title);
|
||
fType := trim(DataBase);
|
||
CANSHU1 := trim(Parameters2);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYFMXlist.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYFMXlist.Handle;
|
||
|
||
end;
|
||
211: //应收款登记
|
||
begin
|
||
if frmYSCR = nil then
|
||
begin
|
||
frmYSCR := TfrmYSCR.Create(application.MainForm);
|
||
with frmYSCR do
|
||
begin
|
||
fmanage := trim(Parameters1);
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYSCR.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYSCR.Handle;
|
||
end;
|
||
212: //应收款明细查询
|
||
begin
|
||
if frmYSCRMXList = nil then
|
||
begin
|
||
frmYSCRMXList := TfrmYSCRMXList.Create(application.MainForm);
|
||
with frmYSCRMXList do
|
||
begin
|
||
fmanage := trim(Parameters1);
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYSCRMXList.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYSCRMXList.Handle;
|
||
end;
|
||
221: //收款登记
|
||
begin
|
||
if frmSKCR = nil then
|
||
begin
|
||
frmSKCR := TfrmSKCR.Create(application.MainForm);
|
||
with frmSKCR do
|
||
begin
|
||
caption := Trim(Title);
|
||
fflag := strtointdef(trim(DataBase), 0);
|
||
fmanage := trim(Parameters1);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmSKCR.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmSKCR.Handle;
|
||
|
||
end;
|
||
231: //应收款收款统计
|
||
begin
|
||
if frmYSSKList = nil then
|
||
begin
|
||
frmYSSKList := TfrmYSSKList.Create(application.MainForm);
|
||
with frmYSSKList do
|
||
begin
|
||
caption := Trim(Title);
|
||
fmanage := trim(DParameters1);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYSSKList.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYSSKList.Handle;
|
||
|
||
end;
|
||
|
||
241: //应收对账单
|
||
begin
|
||
if frmYSMXlist = nil then
|
||
begin
|
||
frmYSMXlist := TfrmYSMXlist.Create(application.MainForm);
|
||
with frmYSMXlist do
|
||
begin
|
||
caption := Trim(Title);
|
||
// fType:='0';
|
||
fType := trim(DataBase);
|
||
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYSMXlist.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYSMXlist.Handle;
|
||
end;
|
||
311: //进项发票管理
|
||
begin
|
||
if frmFDINVOICE = nil then
|
||
begin
|
||
frmFDINVOICE := TfrmFDINVOICE.Create(application.MainForm);
|
||
with frmFDINVOICE do
|
||
begin
|
||
fInvoiceFlag := '0';
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmFDINVOICE.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmFDINVOICE.Handle;
|
||
end;
|
||
312: //进项发票明细
|
||
begin
|
||
if frmFDINVOICE_JMX = nil then
|
||
begin
|
||
frmFDINVOICE_JMX := TfrmFDINVOICE_JMX.Create(application.MainForm);
|
||
with frmFDINVOICE_JMX do
|
||
begin
|
||
fInvoiceFlag := '0';
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmFDINVOICE_JMX.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmFDINVOICE_JMX.Handle;
|
||
end;
|
||
|
||
321: //进项发票统计查询
|
||
begin
|
||
if frmFPInvoice_TJ = nil then
|
||
begin
|
||
frmFPInvoice_TJ := TfrmFPInvoice_TJ.Create(application.MainForm);
|
||
with frmFPInvoice_TJ do
|
||
begin
|
||
fInvoiceFlag := '0';
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmFPInvoice_TJ.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmFPInvoice_TJ.Handle;
|
||
end;
|
||
411: //销项发票
|
||
begin
|
||
if frmFDINVOICE_X = nil then
|
||
begin
|
||
frmFDINVOICE_X := TfrmFDINVOICE_X.Create(application.MainForm);
|
||
with frmFDINVOICE_X do
|
||
begin
|
||
fInvoiceFlag := '1';
|
||
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmFDINVOICE_X.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmFDINVOICE_X.Handle;
|
||
end;
|
||
412: //销项发票明细
|
||
begin
|
||
if frmFDINVOICE_XMX = nil then
|
||
begin
|
||
frmFDINVOICE_XMX := TfrmFDINVOICE_XMX.Create(application.MainForm);
|
||
with frmFDINVOICE_XMX do
|
||
begin
|
||
fInvoiceFlag := '1';
|
||
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmFDINVOICE_XMX.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmFDINVOICE_XMX.Handle;
|
||
end;
|
||
421: //销项发票统计查询
|
||
begin
|
||
if frmXXFPInvoice_TJ = nil then
|
||
begin
|
||
frmXXFPInvoice_TJ := TfrmXXFPInvoice_TJ.Create(application.MainForm);
|
||
with frmXXFPInvoice_TJ do
|
||
begin
|
||
fInvoiceFlag := '1';
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmXXFPInvoice_TJ.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmXXFPInvoice_TJ.Handle;
|
||
end;
|
||
// 422: //销项发票统计查询(低权限)
|
||
// begin
|
||
// if frmXXFPInvoice_TJd = nil then
|
||
// begin
|
||
// frmXXFPInvoice_TJd := TfrmXXFPInvoice_TJd.Create(application.MainForm);
|
||
// with frmXXFPInvoice_TJd do
|
||
// begin
|
||
// fInvoiceFlag := '1';
|
||
// caption := Trim(Title);
|
||
// FormStyle := mstyle;
|
||
// windowState := mstate;
|
||
// BorderStyle := mborderstyle;
|
||
// //show;
|
||
// end;
|
||
// end
|
||
// else
|
||
// frmXXFPInvoice_TJd.BringToFront;
|
||
// //句柄
|
||
// mnewHandle := frmXXFPInvoice_TJd.Handle;
|
||
// end;
|
||
|
||
511: //费用登记
|
||
begin
|
||
if frmCostCR = nil then
|
||
begin
|
||
frmCostCR := TfrmCostCR.Create(application.MainForm);
|
||
with frmCostCR do
|
||
begin
|
||
caption := Trim(Title);
|
||
fflag := strtointdef(trim(DataBase), 0);
|
||
fmanage := trim(Parameters1);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmCostCR.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmCostCR.Handle;
|
||
|
||
end;
|
||
end; // end case
|
||
|
||
Result := mnewHandle;
|
||
// NewDllApp := Application;
|
||
end;
|
||
//===========================================================
|
||
//建立数据库连接池
|
||
//===========================================================
|
||
|
||
function ConnData(): Boolean;
|
||
var
|
||
IniFile: TIniFile;
|
||
begin
|
||
try
|
||
IniFile := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'SYSTEMSET.INI');
|
||
PicSvr := IniFile.ReadString('SERVER', '服务器地址', '127.0.0.1');
|
||
finally
|
||
IniFile.Free;
|
||
end;
|
||
if not Assigned(DataLink_YSYF) then
|
||
DataLink_YSYF := TDataLink_YSYF.Create(Application);
|
||
try
|
||
with DataLink_YSYF.ADOLink do
|
||
begin
|
||
if not Connected then
|
||
begin
|
||
Connected := false;
|
||
ConnectionString := DConString;
|
||
LoginPrompt := false;
|
||
Connected := true;
|
||
end;
|
||
end;
|
||
Result := true;
|
||
except
|
||
Result := false;
|
||
application.MessageBox('数据库连接失败!', '错误', mb_Ok + MB_ICONERROR);
|
||
end;
|
||
end;
|
||
|
||
//initialization
|
||
// OldDllApp := Application;
|
||
//
|
||
//finalization
|
||
// DataLink_YSYF.Free;
|
||
// Application := OldDllApp;
|
||
initialization
|
||
CoInitialize(nil);
|
||
dxUnitsLoader.Initialize;
|
||
|
||
|
||
finalization
|
||
DataLink_YSYF.Free;
|
||
application := NewDllApp;
|
||
dxUnitsLoader.Finalize;
|
||
|
||
end.
|
||
|