D7myChuangpin/创品贸易管理/U_GetDllForm.pas
“ddf” ece69a5ac1 1
2024-07-23 20:18:14 +08:00

324 lines
9.2 KiB
ObjectPascal
Raw Permalink 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_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_iniParam, U_ContractListXF, U_ContractListXF_SH,
U_ProductOrderMoneyList, U_ProductOrderNewList_JD, U_ProductOrderNewList_GDJD,
U_ModulePromptList, U_ProductOrderNewList_HTJD, U_ProductOrderLBNameSet,
U_MJManageNewFDNew, U_MJEdit, U_JYOrderCDOne, U_JYOrderCDOne_HZCX,
U_DJBCKKCList_DDSH, U_ContractListSel, U_OrderMX_CX,
U_ProductOrderMoneyList_BPXCX;
/////////////////////////////////////////////////////////////////
// 功能说明:取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 := '47.100.233.156,7781';
dtbase := 'chuangpingData';
user := 'sa';
pswd := 'rightsoft@123';
DConString := 'Provider=SQLOLEDB.1;Password=' + pswd + ';Persist Security Info=True;User ID=' + user + ';Initial Catalog=' + dtbase + ';Data Source=' + server;
DParameters1 := '高权限';
//DParameters1:='';
//DCode:='002';
//DName:='创品'; //AILEEN
//DParameters3:='FANNY'; //12
end
else
begin
DConString := DataBaseStr;
end;
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;
//调用子模块窗口
case FormID of
0: //订单合同
begin
if frmContractList_XF = nil then
begin
frmContractList_XF := TfrmContractList_XF.Create(application.MainForm);
with frmContractList_XF do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmContractList_XF.BringToFront;
//句柄
mnewHandle := frmContractList_XF.Handle;
end;
1: //订单合同 审核
begin
if frmContractList_XF_SH = nil then
begin
frmContractList_XF_SH := TfrmContractList_XF_SH.Create(application.MainForm);
with frmContractList_XF_SH do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmContractList_XF_SH.BringToFront;
//句柄
mnewHandle := frmContractList_XF_SH.Handle;
end;
3: //生产指示单
begin
if frmProductOrderMoneyList = nil then
begin
frmProductOrderMoneyList := TfrmProductOrderMoneyList.Create(application.MainForm);
with frmProductOrderMoneyList do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmProductOrderMoneyList.BringToFront;
//句柄
mnewHandle := frmProductOrderMoneyList.Handle;
end;
31: //布票查询
begin
if frmProductOrderMoneyList_BPXCX = nil then
begin
frmProductOrderMoneyList_BPXCX := TfrmProductOrderMoneyList_BPXCX.Create(application.MainForm);
with frmProductOrderMoneyList_BPXCX do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmProductOrderMoneyList_BPXCX.BringToFront;
//句柄
mnewHandle := frmProductOrderMoneyList_BPXCX.Handle;
end;
4: //生产指示单进度查询
begin
if frmProductOrderNewList_JD = nil then
begin
frmProductOrderNewList_JD := TfrmProductOrderNewList_JD.Create(application.MainForm);
with frmProductOrderNewList_JD do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmProductOrderNewList_JD.BringToFront;
//句柄
mnewHandle := frmProductOrderNewList_JD.Handle;
end;
5: //订单流程进度查询
begin
if frmOrderMX_CX = nil then
begin
frmOrderMX_CX := TfrmOrderMX_CX.Create(application.MainForm);
with frmOrderMX_CX do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmOrderMX_CX.BringToFront;
//句柄
mnewHandle := frmOrderMX_CX.Handle;
end;
6: //系统提示
begin
if frmModulePromptList = nil then
begin
frmModulePromptList := TfrmModulePromptList.Create(application.MainForm);
with frmModulePromptList do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmModulePromptList.BringToFront;
//句柄
mnewHandle := frmModulePromptList.Handle;
end;
7: //合同进度查询
begin
if frmDJBCKKCList_DDSH = nil then
begin
frmDJBCKKCList_DDSH := TfrmDJBCKKCList_DDSH.Create(application.MainForm);
with frmDJBCKKCList_DDSH do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmDJBCKKCList_DDSH.BringToFront;
//句柄
mnewHandle := frmDJBCKKCList_DDSH.Handle;
end;
end;
Result := mnewHandle;
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');
UserDataFlag := IniFile.ReadString('SERVER', '服务器地址类型', '-1');
finally
IniFile.Free;
end;
if not Assigned(DataLink_TradeManage) then
DataLink_TradeManage := TDataLink_TradeManage.Create(Application);
try
with DataLink_TradeManage.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
CoInitialize(nil);
dxUnitsLoader.Initialize;
finalization
DataLink_TradeManage.Free;
application := NewDllApp;
dxUnitsLoader.Finalize;
end.