D7YPDJlingyao/贸易管理(TradeManage.dll)/U_GetDllForm.pas
DESKTOP-E401PHE\Administrator 43fbfa8db2 ~
2025-07-19 16:53:04 +08:00

261 lines
7.8 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;
function GetsysParam(muserId: pchar; fparam1: pchar): Boolean;
implementation
uses
U_DataLink, U_Fun, U_iniParam, U_MJManageNewFDNew, U_ProductOrderList,
U_ProductOrderAnPai, U_SetBanZu, U_BangAdd, U_MJEdit, U_JYOrderCDOne,
U_JYOrderCDMore, U_CpCkSaoMNewSel, U_CKProductBCPInList, U_CKProductBCPOutList,
U_BanCpHCSaoM, U_CKProductBCPHCList, U_CKProductBCPKCList,
U_CKProductBCPKCHZList, U_CpRkSaoMNew, U_ClothContractList,
U_ClothContractListDH, U_ClothContractListLL, U_ClothContractKCList,
U_ContractList, U_ProductOrderNewList, U_ClothContractListWJG,
U_ClothPDInfoList, U_OrderJDList, U_ProductOrderAnPaiGQX, U_ClothHCList,
U_ContractListNX, U_ClothContractListSX, U_ClothContractListDHSX,
U_ClothContractListLLSX, U_ClothContractListHZ, U_ProductOrderLBNameSet,
U_ClothContractListDHSXQJG, U_ProductOrderNewList_JD, U_ProductOrderNewList_CY,
U_HCList, U_OrderInPut_HYWT, U_ModulePromptList, U_ProductOrderNewList_FB,
U_FanYangList, U_FanYangListHZ, U_CKProductRKHZList, U_CKProductCKHZList,
U_CKJYList, U_ProductOrderLBNameSetFZ, U_Contract_Main, U_Samplelist,
U_Samplelist_SO, U_OrderLRList, U_Samplelist_LY, U_ContractCBYG,
U_ProductOrderNewList_JD1, U_CPDBAO, U_ProductOrderNewList_DY;
/////////////////////////////////////////////////////////////////
// 功能说明:取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);
server := '101.132.143.144,7781';
dtbase := 'lingyaoypdata';
user := 'rtsa';
pswd := 'rightsoft@5740';
DConString := 'Provider=SQLOLEDB.1;Password=' + pswd + ';Persist Security Info=True;User ID=' + user + ';Initial Catalog=' + dtbase + ';Data Source=' + server;
if Trim(DataBaseStr) <> '' then
DConString := DataBaseStr;
// DParameters1:='高权限' ;
// Ddatabase:='';
// DParameters1:='审核';
// DParameters1:='查询';
//DParameters1:='业务员';
// DCode:='007';
// DName:='徐丽娜';
// DParameters2:='管理';
// DParameters2:='';
// database:='';
//DName:='王帅娜';
if not ConnData() then
begin
result := 0;
exit;
end;
if IsINIFile() then
ReadINIFile()
else
WriteINIFile;
GetsysParam('', '');
// 定义窗口类型 、状态
if WinStyle = 0 then
begin
mstyle := fsMDIChild;
mstate := wsMaximized;
mborderstyle := bsSizeable;
end
else
begin
mstyle := fsNormal;
mstate := wsNormal;
mborderstyle := bsSizeable;
end;
////////////////////
/////////////////////
//调用子模块窗口
case FormID of
201: //生产指示单
begin
if frmProductOrderNewList = nil then
begin
frmProductOrderNewList := TfrmProductOrderNewList.Create(application.MainForm);
with frmProductOrderNewList do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmProductOrderNewList.BringToFront;
//句柄
mnewHandle := frmProductOrderNewList.Handle;
end;
301: //打样指示单
begin
if frmProductOrderNewList_DY = nil then
begin
frmProductOrderNewList_DY := TfrmProductOrderNewList_DY.Create(application.MainForm);
with frmProductOrderNewList_DY do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmProductOrderNewList_DY.BringToFront;
//句柄
mnewHandle := frmProductOrderNewList_DY.Handle;
end;
61: //提示窗口
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;
end; // end case
Result := mnewHandle;
// NewDllApp := Application;
end;
function GetsysParam(muserId: pchar; fparam1: pchar): Boolean;
begin
result := true;
//////////////////////////////
shortDateFormat := 'yyyy-MM-dd';
//服务器日期
with DataLink_TradeManage.AdoDataLink do
begin
close;
sql.Clear;
sql.Add('select getDate()as dt');
open;
DServerDate := fieldByName('dt').AsDatetime;
end;
result := true;
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.