D7gmYongjin/坯布生产计划(WeavingSchedule)/U_GetDllForm.pas
DESKTOP-E401PHE\Administrator 8452f471f5 新建3-04
2026-03-04 09:51:44 +08:00

790 lines
23 KiB
ObjectPascal
Raw 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_ClothSCList, U_ClothSCYWYList, U_ClothSCListAnPaiJiTaiAP,
U_ClothSCDCGAnPai, U_ClothGMList, U_MJManageNewFDJJAP, U_JYOrderCDOne,
U_DcgGzList, U_ClothGongYiList, U_JYOrderHZList, U_ClothGYList,
U_ClothSCGYChkList;
/////////////////////////////////////////////////////////////////
// 功能说明:取Dll中得窗体 //
// 参数说明App>>调用应用程序; //
// FormH>>调用窗口句柄 //
// FormID>>窗口号; //
// Language>>语言种类; //
// WinStyle>>窗口类型; //
/////////////////////////////////////////////////////////////////
var
frmClothSCListLR, frmClothSCListSH, frmClothSCListTJ: TfrmClothSCYWYList;
frmClothSCListYWY, frmClothSCListSC, frmClothSCListCX: TfrmClothSCList;
frmClothGongYiList, frmClothGongYiListDJXG, frmClothGongYiListDQX: TfrmClothGongYiList; //生产工艺表
frmJYOrderCDOnePBGL, frmJYOrderCDOnePBCX: TfrmJYOrderCDOnePB;
frmClothSCListAnPaiJiTaiAPGL1, frmClothSCListAnPaiJiTaiAPGL2, frmClothSCListAnPaiJiTaiAPCX: TfrmClothSCListAnPaiJiTaiAP;
frmClothSCDCGAnPai1, frmClothSCDCGAnPai2: TfrmClothSCDCGAnPai;
frmClothGYListLR, frmClothGYListGL, frmClothGYListCX, frmClothGYListDY, frmClothGYListGJ: TfrmClothGYList;
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);
if trim(DConString) = '' then
begin
server := '139.196.189.214,7781';
//server := '.';
dtbase := 'yongjindata';
//dtbase := 'YIFuData';
user := 'YIFUsa';
// user := 'sa';
pswd := 'rightsoft@123';
//pswd := 'rightsoft';
DConString := 'Provider=SQLOLEDB.1;Password=' + pswd + ';Persist Security Info=True;User ID=' + user + ';Initial Catalog=' + dtbase + ';Data Source=' + server;
// DName := '小郑测试';
//DParameters1:='高权限';
//DParameters3:='1';
//DCode:='628';
end
else
begin
DConString := DataBaseStr;
end;
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
-101: //坯布工艺库录入
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '坯布工艺库录入' then
begin
BringWindowToTop(frmClothGYListLR.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmClothGYListLR := TfrmClothGYList.Create(application.MainForm);
with frmClothGYListLR do
begin
Title := '坯布工艺库录入';
canshu1 := '录入';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothGYListLR.BringToFront;
//句柄
mnewHandle := frmClothGYListLR.Handle;
end;
-102: //坯布工艺库管理
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '坯布工艺库管理' then
begin
BringWindowToTop(frmClothGYListGL.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmClothGYListGL := TfrmClothGYList.Create(application.MainForm);
with frmClothGYListGL do
begin
Title := '坯布工艺库管理';
canshu1 := '管理';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothGYListGL.BringToFront;
//句柄
mnewHandle := frmClothGYListGL.Handle;
end;
-103: //坯布工艺库查询
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '坯布工艺库查询' then
begin
BringWindowToTop(frmClothGYListCX.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmClothGYListCX := TfrmClothGYList.Create(application.MainForm);
with frmClothGYListCX do
begin
Title := '坯布工艺库查询';
canshu1 := '查询';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothGYListCX.BringToFront;
//句柄
mnewHandle := frmClothGYListCX.Handle;
end;
-104: //坯布工艺库打印
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '坯布工艺库打印' then
begin
BringWindowToTop(frmClothGYListDY.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmClothGYListDY := TfrmClothGYList.Create(application.MainForm);
with frmClothGYListDY do
begin
Title := '坯布工艺库打印';
canshu1 := '打印';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothGYListDY.BringToFront;
//句柄
mnewHandle := frmClothGYListDY.Handle;
end;
-105: //坯布工艺工价定义
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '坯布工艺工价定义' then
begin
BringWindowToTop(frmClothGYListGJ.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmClothGYListGJ := TfrmClothGYList.Create(application.MainForm);
with frmClothGYListGJ do
begin
Title := '坯布工艺工价定义';
canshu1 := '工价';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothGYListGJ.BringToFront;
//句柄
mnewHandle := frmClothGYListGJ.Handle;
end;
101: //坯布生产计划单录入
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '坯布生产计划单录入' then
begin
BringWindowToTop(frmClothSCListLR.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmClothSCListLR := TfrmClothSCYWYList.Create(application.MainForm);
with frmClothSCListLR do
begin
Title := '坯布生产计划单录入';
canshu1 := '录入';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothSCListLR.BringToFront;
//句柄
mnewHandle := frmClothSCListLR.Handle;
end;
102: //坯布生产计划单审核
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '坯布生产计划单审核' then
begin
BringWindowToTop(frmClothSCListSH.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmClothSCListSH := TfrmClothSCYWYList.Create(application.MainForm);
with frmClothSCListSH do
begin
Title := '坯布生产计划单审核';
canshu1 := '审核';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothSCListSH.BringToFront;
//句柄
mnewHandle := frmClothSCListSH.Handle;
end;
103: //坯布生产计划单调价
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '坯布生产计划单调价' then
begin
BringWindowToTop(frmClothSCListTJ.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmClothSCListTJ := TfrmClothSCYWYList.Create(application.MainForm);
with frmClothSCListTJ do
begin
Title := '坯布生产计划单调价';
canshu1 := '调价';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothSCListTJ.BringToFront;
//句柄
mnewHandle := frmClothSCListTJ.Handle;
end;
111: //坯布工艺单
begin
if frmClothSCGYChkList = nil then
begin
frmClothSCGYChkList := TfrmClothSCGYChkList.Create(application.MainForm);
with frmClothSCGYChkList do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothSCGYChkList.BringToFront;
//句柄
mnewHandle := frmClothSCGYChkList.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(frmClothSCListSC.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmClothSCListSC := TfrmClothSCList.Create(application.MainForm);
with frmClothSCListSC do
begin
Title := '坯布工艺单';
canshu1 := '录入';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothSCListSC.BringToFront;
//句柄
mnewHandle := frmClothSCListSC.Handle;
end;
113: //坯布工艺单(业务员)
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '坯布工艺单(业务员)' then
begin
BringWindowToTop(frmClothSCListYWY.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmClothSCListYWY := TfrmClothSCList.Create(application.MainForm);
with frmClothSCListYWY do
begin
Title := '坯布工艺单(业务员)';
canshu1 := '业务员';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothSCListYWY.BringToFront;
//句柄
mnewHandle := frmClothSCListYWY.Handle;
end; }
901: //坯布工艺库
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '坯布工艺库' then
begin
BringWindowToTop(frmClothGongYiList.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmClothGongYiList := TfrmClothGongYiList.Create(application.MainForm);
with frmClothGongYiList do
begin
Title := '坯布工艺库';
canshu1 := '高权限';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothGongYiList.BringToFront;
//句柄
mnewHandle := frmClothGongYiList.Handle;
end;
902: //坯布工艺库单价修改
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '坯布工艺库单价修改' then
begin
BringWindowToTop(frmClothGongYiListDJXG.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmClothGongYiListDJXG := TfrmClothGongYiList.Create(application.MainForm);
with frmClothGongYiListDJXG do
begin
Title := '坯布工艺库单价修改';
canshu1 := '单价修改';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothGongYiListDJXG.BringToFront;
//句柄
mnewHandle := frmClothGongYiListDJXG.Handle;
end;
903: //坯布工艺库低权限
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '坯布工艺库低权限' then
begin
BringWindowToTop(frmClothGongYiListDQX.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmClothGongYiListDQX := TfrmClothGongYiList.Create(application.MainForm);
with frmClothGongYiListDQX do
begin
Title := '坯布工艺库低权限';
canshu1 := '低权限';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothGongYiListDQX.BringToFront;
//句柄
mnewHandle := frmClothGongYiListDQX.Handle;
end;
112: //坯布生产计划单查询
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '坯布生产计划单查询' then
begin
BringWindowToTop(frmClothSCListCX.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmClothSCListCX := TfrmClothSCList.Create(application.MainForm);
with frmClothSCListCX do
begin
Title := '坯布生产计划单查询';
canshu1 := '查询';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothSCListCX.BringToFront;
//句柄
mnewHandle := frmClothSCListCX.Handle;
end;
301: //布票打印
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '布票打印' then
begin
BringWindowToTop(frmClothSCDCGAnPai1.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmClothSCDCGAnPai1 := TfrmClothSCDCGAnPai.Create(application.MainForm);
with frmClothSCDCGAnPai1 do
begin
Title := '布票打印';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothSCDCGAnPai1.BringToFront;
//句柄
mnewHandle := frmClothSCDCGAnPai1.Handle;
end;
401: //手工挂码
begin
if frmClothGMList = nil then
begin
frmClothGMList := TfrmClothGMList.Create(application.MainForm);
with frmClothGMList do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothGMList.BringToFront;
//句柄
mnewHandle := frmClothGMList.Handle;
end;
402: // 坯布检验
begin
if frmMJManageNewFDJJAP = nil then
begin
frmMJManageNewFDJJAP := TfrmMJManageNewFDJJAP.Create(application.MainForm);
with frmMJManageNewFDJJAP do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmMJManageNewFDJJAP.BringToFront;
//句柄
mnewHandle := frmMJManageNewFDJJAP.Handle;
end;
501: //检验信息管理
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '检验信息管理' then
begin
BringWindowToTop(frmJYOrderCDOnePBGL.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmJYOrderCDOnePBGL := TfrmJYOrderCDOnePB.Create(application.MainForm);
with frmJYOrderCDOnePBGL do
begin
Title := '检验信息管理';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmJYOrderCDOnePBGL.BringToFront;
//句柄
mnewHandle := frmJYOrderCDOnePBGL.Handle;
end;
502: //检验信息查询
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '检验信息查询' then
begin
BringWindowToTop(frmJYOrderCDOnePBCX.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListBGZL=nil then
begin
frmJYOrderCDOnePBCX := TfrmJYOrderCDOnePB.Create(application.MainForm);
with frmJYOrderCDOnePBCX do
begin
Title := '检验信息查询';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmJYOrderCDOnePBCX.BringToFront;
//句柄
mnewHandle := frmJYOrderCDOnePBCX.Handle;
end;
504: //检验信息汇总查询
begin
if frmJYOrderHZList = nil then
begin
frmJYOrderHZList := TfrmJYOrderHZList.Create(application.MainForm);
with frmJYOrderHZList do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmJYOrderHZList.BringToFront;
//句柄
mnewHandle := frmJYOrderHZList.Handle;
end;
601: //次布统计表
begin
if frmDcgGzList = nil then
begin
frmDcgGzList := TfrmDcgGzList.Create(application.MainForm);
with frmDcgGzList do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmDcgGzList.BringToFront;
//句柄
mnewHandle := frmDcgGzList.Handle;
end;
end;
Result := mnewHandle;
end;
//===========================================================
//建立数据库连接池
//===========================================================
function ConnData(): Boolean;
begin
if not Assigned(DataLink_WeavingSchedule) then
DataLink_WeavingSchedule := TDataLink_WeavingSchedule.Create(Application);
try
with DataLink_WeavingSchedule.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_WeavingSchedule.Free;
application := NewDllApp;
dxUnitsLoader.Finalize;
end.