D7myzhenyong/报关管理(BaoGuan.dll)/U_GetDllForm.pas
DESKTOP-E401PHE\Administrator 237de1c308 0
2025-08-26 15:25:51 +08:00

905 lines
26 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, 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_BaoGuanList, U_BaoGuanListZXD, U_BaoGuanXSList, U_BaoGuanCRKCX,
U_ContractDCList, U_ContractDCListChk, U_CHList, U_BaoGuanListQR, U_YFGLList,
U_JHDMAKELIST, U_XYZMAKELIST, U_CHHZList, U_GJKDList, U_JDDATEManage,
U_XSQKList;
var
frmBaoGuanList, frmBaoGuanListGQX, frmBaoGuanListCXGQX, frmBaoGuanListZL: TfrmBaoGuanList;
frmBaoGuanListHT, frmBaoGuanListFP, frmBaoGuanListZXD, frmBaoGuanListBGD: TfrmBaoGuanList;
frmBaoGuanListSBYS, frmBaoGuanListHD, frmBaoGuanListSH, frmBaoGuanListDJ: TfrmBaoGuanList;
frmContractDCListLR, frmContractDCListGL, frmContractDCListZZ, frmContractDCListQR: TfrmContractDCList;
frmCHList, frmCHGLList: TfrmCHList;
frmCHhzList: TfrmCHhzList;
frmYFGLList, frmYFCXList: TfrmYFGLList;
frmBaoGuanListQR: TfrmBaoGuanListQR;
frmJHDMAKEList: TfrmJHDMAKEList; //结汇单制作
frmxyzMAKEList: TfrmxyzMAKEList; //信用证制作
frmGJKDList: TfrmGJKDList;
frmXSQKLLIST: tfrmXSQKLLIST;
/////////////////////////////////////////////////////////////////
// 功能说明:取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
i: Integer;
bFound: Boolean;
mnewHandle: hwnd;
mstyle: TFormStyle; // 0:子窗口; 1普通窗口
mstate: TWindowState;
mborderstyle: TFormBorderStyle;
begin
mnewHandle := 0;
DName := PChar(GName);
DCode := PChar(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 := '47.100.130.130,7781';
// server := '.';
dtbase := 'zhenyongdata';
user := 'zhenyongsa';
pswd := 'rightsoft@9101';
// pswd := 'rightsoft';
DConString := 'Provider=SQLOLEDB.1;Password=' + pswd + ';Persist Security Info=True;User ID=' + user + ';Initial Catalog=' + dtbase + ';Data Source=' + server;
DConString := DataBaseStr;
// DName:='司洋';
//DParameters1:='高权限';
//DParameters2:='';
if not ConnData() then
begin
result := 0;
exit;
end;
// 定义窗口类型 、状态
if WinStyle = 0 then
begin
mstyle := fsMDIChild;
mstate := wsMaximized;
mborderstyle := bsSizeable;
end
else
begin
mstyle := fsNormal;
mstate := wsNormal;
mborderstyle := bsSizeable;
end;
//Title:='报关管理';
/////////////////////
//调用子模块窗口
case FormID of
211: //订舱指示书
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '订舱指示书' then
begin
BringWindowToTop(frmContractDCListLR.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmContractDCListLR := TfrmContractDCList.Create(application.MainForm);
with frmContractDCListLR do
begin
canshu1 := '录入';
Title := '订舱指示书';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmContractDCListLR.BringToFront;
//句柄
mnewHandle := frmContractDCListLR.Handle;
end;
212: //订舱指示书(组长)
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '订舱指示书(组长)' then
begin
BringWindowToTop(frmContractDCListZZ.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmContractDCListZZ := tfrmContractDCList.Create(application.MainForm);
with frmContractDCListZZ do
begin
canshu1 := '录入';
canshu2 := '组长';
Title := '订舱指示书(组长)';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmContractDCListZZ.BringToFront;
//句柄
mnewHandle := frmContractDCListZZ.Handle;
end;
221: //订舱指示书审核
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '订舱指示书审核' then
begin
BringWindowToTop(frmContractDCListGL.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmContractDCListGL := TfrmContractDCList.Create(application.MainForm);
with frmContractDCListGL do
begin
canshu1 := '管理';
Title := '订舱指示书';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmContractDCListGL.BringToFront;
//句柄
mnewHandle := frmContractDCListGL.Handle;
end;
223: //订舱指示书确认
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '订舱指示书确认' then
begin
BringWindowToTop(frmContractDCListQR.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmContractDCListQR := TfrmContractDCList.Create(application.MainForm);
with frmContractDCListQR do
begin
canshu1 := '确认';
Title := '订舱指示书确认';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmContractDCListQR.BringToFront;
//句柄
mnewHandle := frmContractDCListQR.Handle;
end;
// 211: //订舱指示书
// begin
// if frmContractDCList = nil then
// begin
// frmContractDCList := TfrmContractDCList.Create(application.MainForm);
// with frmContractDCList do
// begin
// caption := Trim(Title);
// FormStyle := mstyle;
// windowState := mstate;
// BorderStyle := mborderstyle;
// //show;
// end;
// end
// else
// frmContractDCList.BringToFront;
// //句柄
// mnewHandle := frmContractDCList.Handle;
//
// end;
// 221: //订舱指示书审核
// begin
// if frmContractDCListChk = nil then
// begin
// frmContractDCListChk := TfrmContractDCListChk.Create(application.MainForm);
// with frmContractDCListChk do
// begin
// caption := Trim(Title);
// FormStyle := mstyle;
// windowState := mstate;
// BorderStyle := mborderstyle;
// //show;
// end;
// end
// else
// frmContractDCListChk.BringToFront;
// //句柄
// mnewHandle := frmContractDCListChk.Handle;
//
// end;
11: //出货清单
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '出货清单' then
begin
BringWindowToTop(frmCHList.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanList=nil then
begin
frmCHList := TfrmCHList.Create(application.MainForm);
with frmCHList do
begin
Title := '出货清单';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmCHList.BringToFront;
//句柄
mnewHandle := frmCHList.Handle;
end;
111: //开票确认
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '开票确认' then
begin
BringWindowToTop(frmCHGLList.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanList=nil then
begin
frmCHGLList := TfrmCHList.Create(application.MainForm);
with frmCHGLList do
begin
Title := '开票确认';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmCHGLList.BringToFront;
//句柄
mnewHandle := frmCHGLList.Handle;
end;
12: //运费管理
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '运费管理' then
begin
BringWindowToTop(frmYFGLList.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanList=nil then
begin
frmYFGLList := TfrmYFGLList.Create(application.MainForm);
with frmYFGLList do
begin
Title := '运费管理';
canshu1 := '管理';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmYFGLList.BringToFront;
//句柄
mnewHandle := frmYFGLList.Handle;
end;
121: //运费查询
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '运费查询' then
begin
BringWindowToTop(frmYFCXList.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanList=nil then
begin
frmYFCXList := TfrmYFGLList.Create(application.MainForm);
with frmYFCXList do
begin
Title := '运费查询';
canshu1 := '查询';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmYFCXList.BringToFront;
//句柄
mnewHandle := frmYFCXList.Handle;
end;
13: //出货汇总清单
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '出货汇总清单' then
begin
BringWindowToTop(frmCHhzList.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanList=nil then
begin
frmCHhzList := TfrmCHhzList.Create(application.MainForm);
with frmCHhzList do
begin
Title := '出货汇总清单';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmCHhzList.BringToFront;
//句柄
mnewHandle := frmCHhzList.Handle;
end;
131: //销售情况表
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '出货汇总清单' then
begin
BringWindowToTop(frmXSQKLLIST.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanList=nil then
begin
frmXSQKLLIST := TfrmXSQKLLIST.Create(application.MainForm);
with frmXSQKLLIST do
begin
Title := '销售情况表';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmXSQKLLIST.BringToFront;
//句柄
mnewHandle := frmXSQKLLIST.Handle;
end;
14: //国际快递
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '国际快递' then
begin
BringWindowToTop(frmGJKDList.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanList=nil then
begin
frmGJKDList := TfrmGJKDList.Create(application.MainForm);
with frmGJKDList do
begin
Title := '国际快递';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmGJKDList.BringToFront;
//句柄
mnewHandle := frmGJKDList.Handle;
end;
-1: //报关资料录入
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '报关资料录入' then
begin
BringWindowToTop(frmBaoGuanList.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanList=nil then
begin
frmBaoGuanList := TfrmBaoGuanList.Create(application.MainForm);
with frmBaoGuanList do
begin
Title := '报关资料录入';
canshu3 := '业务员';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanList.BringToFront;
//句柄
mnewHandle := frmBaoGuanList.Handle;
end;
-2: //报关资料录入(高权限)
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '报关资料录入(高权限)' then
begin
BringWindowToTop(frmBaoGuanListGQX.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanList=nil then
begin
frmBaoGuanListGQX := TfrmBaoGuanList.Create(application.MainForm);
with frmBaoGuanListGQX do
begin
Title := '报关资料录入(高权限)';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanListGQX.BringToFront;
//句柄
mnewHandle := frmBaoGuanListGQX.Handle;
end;
-7: //报关资料审核
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '报关资料审核' then
begin
BringWindowToTop(frmBaoGuanListQR.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListSBYS=nil then
begin
frmBaoGuanListQR := TfrmBaoGuanListQR.Create(application.MainForm);
with frmBaoGuanListQR do
begin
Title := '报关资料审核';
canshu3 := '单证';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanListQR.BringToFront;
//句柄
mnewHandle := frmBaoGuanListQR.Handle;
end;
-5: //报关资料查询(高权限)
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '报关资料查询(高权限)' then
begin
BringWindowToTop(frmBaoGuanListCXGQX.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListBGZL=nil then
begin
frmBaoGuanListCXGQX := TfrmBaoGuanList.Create(application.MainForm);
with frmBaoGuanListCXGQX do
begin
Title := '报关资料查询(高权限)';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanListCXGQX.BringToFront;
//句柄
mnewHandle := frmBaoGuanListCXGQX.Handle;
end;
-6: //报关销售资料
begin
if frmBaoGuanXSList = nil then
begin
frmBaoGuanXSList := TfrmBaoGuanXSList.Create(application.MainForm);
with frmBaoGuanXSList do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanXSList.BringToFront;
//句柄
mnewHandle := frmBaoGuanXSList.Handle;
end;
1: //报关管理(单机)
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '报关管理' then
begin
BringWindowToTop(frmBaoGuanListDJ.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanList=nil then
begin
frmBaoGuanListDJ := TfrmBaoGuanList.Create(application.MainForm);
with frmBaoGuanListDJ do
begin
Title := '报关管理';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanListDJ.BringToFront;
//句柄
mnewHandle := frmBaoGuanListDJ.Handle;
end;
2: //报关出入库查询
begin
if frmBaoGuanCRKCX = nil then
begin
frmBaoGuanCRKCX := TfrmBaoGuanCRKCX.Create(application.MainForm);
with frmBaoGuanCRKCX do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanCRKCX.BringToFront;
//句柄
mnewHandle := frmBaoGuanCRKCX.Handle;
end;
-3: //报关资料核对
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '报关资料核对' then
begin
BringWindowToTop(frmBaoGuanListHD.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListSBYS=nil then
begin
frmBaoGuanListHD := TfrmBaoGuanList.Create(application.MainForm);
with frmBaoGuanListHD do
begin
Title := '报关资料核对';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanListHD.BringToFront;
//句柄
mnewHandle := frmBaoGuanListHD.Handle;
end;
-4: //报关资料审核
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '报关资料审核' then
begin
BringWindowToTop(frmBaoGuanListSH.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListSBYS=nil then
begin
frmBaoGuanListSH := TfrmBaoGuanList.Create(application.MainForm);
with frmBaoGuanListSH do
begin
Title := '报关资料审核';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmBaoGuanListSH.BringToFront;
//句柄
mnewHandle := frmBaoGuanListSH.Handle;
end;
44: //结汇单制作
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '结汇单制作' then
begin
BringWindowToTop(frmJHDMAKEList.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListSBYS=nil then
begin
frmJHDMAKEList := TfrmJHDMAKEList.Create(application.MainForm);
with frmJHDMAKEList do
begin
Title := '结汇单制作';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmJHDMAKEList.BringToFront;
//句柄
mnewHandle := frmJHDMAKEList.Handle;
end;
51: //信用证管理
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '信用证管理' then
begin
BringWindowToTop(frmxyzMAKEList.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListSBYS=nil then
begin
frmxyzMAKEList := TfrmxyzMAKEList.Create(application.MainForm);
with frmxyzMAKEList do
begin
Title := '信用证管理';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmxyzMAKEList.BringToFront;
//句柄
mnewHandle := frmxyzMAKEList.Handle;
end;
99: //报单日期管理
begin
if frmjddateManage = nil then
begin
frmjddateManage := TfrmjddateManage.Create(application.MainForm);
with frmjddateManage do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmjddateManage.BringToFront;
//句柄
mnewHandle := frmjddateManage.Handle;
end;
end; // end case
Result := mnewHandle;
// NewDllApp := Application;
end;
//===========================================================
//建立数据库连接池
//===========================================================
function ConnData(): Boolean;
begin
if not Assigned(DataLink_DDMD) then
DataLink_DDMD := TDataLink_DDMD.Create(Application);
try
with DataLink_DDMD.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_DDMD.Free;
application := NewDllApp;
dxUnitsLoader.Finalize;
//initialization
// OldDllApp := Application;
//
//finalization
// DataLink_DDMD.Free;
// Application := OldDllApp;
end.