D7myzhenyong/样布仓库(染色)/U_GetDllForm.pas
DESKTOP-E401PHE\Administrator 237de1c308 0
2025-08-26 15:25:51 +08:00

778 lines
23 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_PieceSampleRklist, U_PieceSampleCKlist, U_PieceSampleKcList,
U_PieceSampleKcHZList, U_ElevatorRklist, U_ElevatorCKlist, U_ElevatorKcList,
U_SampleSendinglist, U_JYGLlist, U_JYSQlist, U_SMPBRklist, U_SMPBKcList,
U_SMPBCKlist, U_ProductOrderLYList, U_SMPBKcHZList, U_XYHDBLYList;
/////////////////////////////////////////////////////////////////
// 功能说明:取Dll中得窗体 //
// 参数说明App>>调用应用程序; //
// FormH>>调用窗口句柄 //
// FormID>>窗口号; //
// Language>>语言种类; //
// WinStyle>>窗口类型; //
/////////////////////////////////////////////////////////////////
var
frmPieceSampleRklistRSD, frmPieceSampleRklistRSG, frmPieceSampleRklistYHD, frmPieceSampleRklistYHG: TfrmPieceSampleRklist;
frmSMPBRklist: tfrmSMPBRklist;
frmPieceSampleCKlistRS, frmPieceSampleCKlistYH: TfrmPieceSampleCKlist;
frmSMPBCKlist: TfrmSMPBCKlist;
frmJYGLlistLR, frmJYGLlistSH: TfrmJYGLlist;
frmElevatorRklist: TfrmElevatorRklist;
frmElevatorCklist: TfrmElevatorCklist;
frmSampleSendinglistDJ, frmSampleSendinglistGL: TfrmSampleSendinglist;
frmJYSQLIST, frmJYSQLISTd: TfrmJYSQLIST;
frmPieceSampleKcListKF, frmPieceSampleKcList, frmPieceSampleKcListYH: TfrmPieceSampleKcList;
frmsmpbKcList: TfrmsmpbKcList;
frmPieceSampleKcHZList, frmPieceSampleKcHZListYH: TfrmPieceSampleKcHZList;
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';
// dtbase := 'cszhenyong';
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:='admin';
// DParameters1:='王小洪';
//DParameters3:='1';
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;
/////////////////////
//调用子模块窗口
case FormID of
17: //寄样申请(低权限) //
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '寄样申请录入' then
begin
BringWindowToTop(frmJYSQLISTD.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmJYSQLISTD := TfrmJYSQLIST.Create(application.MainForm);
with frmJYSQLISTD do
begin
Title := '寄样申请录入';
canshu1 := '录入';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmJYSQLISTD.BringToFront;
//句柄
mnewHandle := frmJYSQLISTD.Handle;
end;
18: //寄样申请 //
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '寄样申请管理' then
begin
BringWindowToTop(frmJYSQLIST.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmJYSQLIST := TfrmJYSQLIST.Create(application.MainForm);
with frmJYSQLIST do
begin
Title := '寄样申请管理';
canshu1 := '管理';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmJYSQLIST.BringToFront;
//句柄
mnewHandle := frmJYSQLIST.Handle;
end;
211: //样布入库
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '染色样布入库' then
begin
BringWindowToTop(frmPieceSampleRklistRSD.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmPieceSampleRklistRSD := TfrmPieceSampleRklist.Create(application.MainForm);
with frmPieceSampleRklistRSD do
begin
Title := '染色样布入库';
fCKName := '匹样';
canshu1 := '高权限';
canshu2 := '染色';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmPieceSampleRklistRSD.BringToFront;
//句柄
mnewHandle := frmPieceSampleRklistRSD.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(frmPieceSampleRklistRSG.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmPieceSampleRklistRSG := TfrmPieceSampleRklist.Create(application.MainForm);
with frmPieceSampleRklistRSG do
begin
Title := '染色样布入库(仓库)';
fCKName := '匹样';
canshu1 := '仓库';
canshu2 := '染色';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmPieceSampleRklistRSG.BringToFront;
//句柄
mnewHandle := frmPieceSampleRklistRSG.Handle;
end;
213: //样布入库(印花)
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '印花样布入库' then
begin
BringWindowToTop(frmPieceSampleRklistYHD.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmPieceSampleRklistYHD := TfrmPieceSampleRklist.Create(application.MainForm);
with frmPieceSampleRklistYHD do
begin
Title := '印花样布入库';
fCKName := '匹样';
canshu1 := '高权限';
canshu2 := '印花';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmPieceSampleRklistYHD.BringToFront;
//句柄
mnewHandle := frmPieceSampleRklistYHD.Handle;
end;
214: //样布入库仓库
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '印花样布入库(仓库)' then
begin
BringWindowToTop(frmPieceSampleRklistYHG.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmPieceSampleRklistYHG := TfrmPieceSampleRklist.Create(application.MainForm);
with frmPieceSampleRklistYHG do
begin
Title := '印花样布入库(仓库)';
fCKName := '匹样';
canshu1 := '仓库';
canshu2 := '染色';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmPieceSampleRklistYHG.BringToFront;
//句柄
mnewHandle := frmPieceSampleRklistYHG.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(frmPieceSampleCKlistRS.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmPieceSampleCKlistRS := TfrmPieceSampleCKlist.Create(application.MainForm);
with frmPieceSampleCKlistRS do
begin
Title := '染色样布出库';
fCKName := '匹样';
canshu1 := '高权限';
canshu2 := '染色';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmPieceSampleCKlistRS.BringToFront;
//句柄
mnewHandle := frmPieceSampleCKlistRS.Handle;
end;
222: //印花样布出库
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '印花样布出库' then
begin
BringWindowToTop(frmPieceSampleCKlistYH.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmPieceSampleCKlistYH := TfrmPieceSampleCKlist.Create(application.MainForm);
with frmPieceSampleCKlistYH do
begin
Title := '印花样布出库';
fCKName := '匹样';
canshu1 := '高权限';
canshu2 := '印花';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmPieceSampleCKlistYH.BringToFront;
//句柄
mnewHandle := frmPieceSampleCKlistYH.Handle;
end;
231: //样布库存
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '染色样布库存' then
begin
BringWindowToTop(frmPieceSampleKcList.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmPieceSampleKcList := TfrmPieceSampleKcList.Create(application.MainForm);
with frmPieceSampleKcList do
begin
Title := '染色样布库存';
fCKName := '匹样';
canshu1 := '管理';
yptype.Text := '染色';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmPieceSampleKcList.BringToFront;
//句柄
mnewHandle := frmPieceSampleKcList.Handle;
end;
233: //样布库存(客服)
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '样布库存(客服)' then
begin
BringWindowToTop(frmPieceSampleKcListKF.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmPieceSampleKcListKF := TfrmPieceSampleKcList.Create(application.MainForm);
with frmPieceSampleKcListKF do
begin
Title := '样布库存(客服)';
fCKName := '匹样';
canshu1 := '客服';
yptype.Text := '染色';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmPieceSampleKcListKF.BringToFront;
//句柄
mnewHandle := frmPieceSampleKcListKF.Handle;
end;
234: //样布库存 (印花)
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '印花样布库存' then
begin
BringWindowToTop(frmPieceSampleKcListYH.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmPieceSampleKcListYH := TfrmPieceSampleKcList.Create(application.MainForm);
with frmPieceSampleKcListYH do
begin
Title := '印花样布库存';
fCKName := '匹样';
canshu1 := '管理';
yptype.Text := '印花';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmPieceSampleKcListYH.BringToFront;
//句柄
mnewHandle := frmPieceSampleKcListYH.Handle;
end;
232: //样布库存汇总染色
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '染色样布汇总库存' then
begin
BringWindowToTop(frmPieceSampleKcHZList.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmPieceSampleKcHZList := TfrmPieceSampleKcHZList.Create(application.MainForm);
with frmPieceSampleKcHZList do
begin
Title := '染色样布汇总库存';
fCKName := '匹样';
// canshu1 := '管理';
yptype.Text := '染色';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmPieceSampleKcHZList.BringToFront;
//句柄
mnewHandle := frmPieceSampleKcHZList.Handle;
end;
2321: //样布库存汇总印花
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '印花样布汇总库存' then
begin
BringWindowToTop(frmPieceSampleKcHZListyh.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmPieceSampleKcHZListyh := TfrmPieceSampleKcHZList.Create(application.MainForm);
with frmPieceSampleKcHZListyh do
begin
Title := '印花样布汇总库存';
fCKName := '匹样';
// canshu1 := '管理';
yptype.Text := '印花';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmPieceSampleKcHZListyh.BringToFront;
//句柄
mnewHandle := frmPieceSampleKcHZListyh.Handle;
end;
255: //计划单留样统计
begin
if frmProductOrderLYList = nil then
begin
frmProductOrderLYList := TfrmProductOrderLYList.Create(application.MainForm);
with frmProductOrderLYList do
begin
caption := Trim(Title);
// fCkName := trim(Parameters1);
// canshu2 := trim(Parameters2);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmProductOrderLYList.BringToFront;
//句柄
mnewHandle := frmProductOrderLYList.Handle;
end;
256: //新印花底部留样清单
begin
if frmXYHDBLYLIST = nil then
begin
frmXYHDBLYLIST := TfrmXYHDBLYLIST.Create(application.MainForm);
with frmXYHDBLYLIST do
begin
caption := Trim(Title);
// fCkName := trim(Parameters1);
// canshu2 := trim(Parameters2);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmXYHDBLYLIST.BringToFront;
//句柄
mnewHandle := frmXYHDBLYLIST.Handle;
end;
411: //数码坯布入库
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '数码坯布入库' then
begin
BringWindowToTop(frmSMPBRklist.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmSMPBRklist := TfrmSMPBRklist.Create(application.MainForm);
with frmSMPBRklist do
begin
Title := '数码坯布入库';
fCKName := '数码';
canshu1 := '高权限';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmSMPBRklist.BringToFront;
//句柄
mnewHandle := frmSMPBRklist.Handle;
end;
421: //数码坯布出库
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '数码坯布出库' then
begin
BringWindowToTop(frmsmpbCKlist.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmsmpbCKlist := TfrmsmpbCKlist.Create(application.MainForm);
with frmsmpbCKlist do
begin
Title := '数码坯布出库';
fCKName := '数码';
canshu1 := '高权限';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmsmpbCKlist.BringToFront;
//句柄
mnewHandle := frmsmpbCKlist.Handle;
end;
431: //数码坯布库存
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '数码坯布库存' then
begin
BringWindowToTop(frmSMPBKcList.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmSMPBKcList := TfrmSMPBKcList.Create(application.MainForm);
with frmSMPBKcList do
begin
Title := '数码坯布库存';
fCKName := '数码';
canshu1 := '管理';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmSMPBKcList.BringToFront;
//句柄
mnewHandle := frmSMPBKcList.Handle;
end;
432: //数码坯布汇总库存
begin
if frmSMPBKcHZList = nil then
begin
frmSMPBKcHZList := TfrmSMPBKcHZList.Create(application.MainForm);
with frmSMPBKcHZList do
begin
caption := Trim(Title);
fCKName := '数码';
// fCkName := trim(Parameters1);
// canshu2 := trim(Parameters2);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmSMPBKcHZList.BringToFront;
//句柄
mnewHandle := frmSMPBKcHZList.Handle;
end
end;
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');
UserDataFlag := IniFile.ReadString('SERVER', '服务器地址类型', '-1');
finally
IniFile.Free;
end;
if not Assigned(DataLink_SampleWarehouse) then
DataLink_SampleWarehouse := TDataLink_SampleWarehouse.Create(Application);
try
with DataLink_SampleWarehouse.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_SampleWarehouse.Free;
// Application := OldDllApp;
initialization
CoInitialize(nil);
dxUnitsLoader.Initialize;
finalization
DataLink_SampleWarehouse.Free;
application := NewDllApp;
dxUnitsLoader.Finalize;
end.