D7zzHanglin/坯布生产计划(WeavingSchedule)/U_GetDllForm.pas

450 lines
13 KiB
ObjectPascal
Raw Normal View History

2025-08-06 16:42:07 +08:00
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_ClothSCListAnPaiJiTaiAP, U_ClothSCDCGAnPai,
U_ClothGMList, U_MJManageNewFDJJAP, U_JYOrderCDOne, U_DcgGzList, U_ClothTHList;
/////////////////////////////////////////////////////////////////
// <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>:ȡDll<6C>еô<D0B5><C3B4><EFBFBD> //
// <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD>App>><3E><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD> //
// FormH>><3E><><EFBFBD>ô<EFBFBD><C3B4>ھ<EFBFBD><DABE><EFBFBD> <20><> //
// FormID>><3E><><EFBFBD>ں<EFBFBD>; //
// Language>><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; //
// WinStyle>><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD> //
/////////////////////////////////////////////////////////////////
var
frmClothSCListLR, frmClothSCListSC1, frmClothSCListSC2, frmClothSCListCX: TfrmClothSCList;
frmJYOrderCDOnePBGL, frmJYOrderCDOnePBCX: TfrmJYOrderCDOnePB;
frmClothSCListAnPaiJiTaiAPGL1, frmClothSCListAnPaiJiTaiAPGL2, frmClothSCListAnPaiJiTaiAPCX: TfrmClothSCListAnPaiJiTaiAP;
frmClothSCDCGAnPai1, frmClothSCDCGAnPai2: TfrmClothSCDCGAnPai;
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:<3A>Ӵ<EFBFBD><D3B4><EFBFBD>; 1<><31><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>
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;
//<2F><>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
SetLength(server, 255);
SetLength(dtbase, 255);
SetLength(user, 255);
SetLength(pswd, 255);
server := '121.40.233.100,7781';
//server:='.';
pswd := 'rightsoft@123';
user := 'sa';
dtbase := 'hanglindata';
DConString := 'Provider=SQLOLEDB.1;Password=' + pswd + ';Persist Security Info=True;User ID=' + user + ';Initial Catalog=' + dtbase + ';Data Source=' + server;
DConString := DataBaseStr;
// DName := '̷<><CCB7><EFBFBD><EFBFBD>';
// DParameters1 := 'BS';
//DParameters3:='1';
if not ConnData() then
begin
result := 0;
exit;
end;
// <20><><EFBFBD><EFBFBD><E5B4B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>״̬
if WinStyle = 0 then
begin
mstyle := fsMDIChild;
mstate := wsMaximized;
mborderstyle := bsSizeable;
end
else
begin
mstyle := fsNormal;
mstate := wsNormal;
mborderstyle := bsSizeable;
end;
/////////////////////
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><E9B4B0>
case FormID of
101: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>¼<EFBFBD><C2BC>
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>¼<EFBFBD><C2BC>' then
begin
BringWindowToTop(frmClothSCListLR.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmClothSCListLR := TfrmClothSCList.Create(application.MainForm);
with frmClothSCListLR do
begin
Title := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD>¼<EFBFBD><C2BC>';
canshu1 := <><C2BC>';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothSCListLR.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmClothSCListLR.Handle;
end;
102: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>ѯ
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>ѯ' 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 := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>ѯ';
canshu1 := '<27><>ѯ';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothSCListCX.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmClothSCListCX.Handle;
end;
201: //<2F><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>' then
begin
BringWindowToTop(frmClothSCListAnPaiJiTaiAPGL1.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmClothSCListAnPaiJiTaiAPGL1 := TfrmClothSCListAnPaiJiTaiAP.Create(application.MainForm);
with frmClothSCListAnPaiJiTaiAPGL1 do
begin
Title := '<27><>̨<EFBFBD><CCA8><EFBFBD><EFBFBD>';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothSCListAnPaiJiTaiAPGL1.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmClothSCListAnPaiJiTaiAPGL1.Handle;
end;
202: //<2F><>̨<EFBFBD><CCA8><EFBFBD>Ų<EFBFBD>ѯ
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><>̨<EFBFBD><CCA8><EFBFBD>Ų<EFBFBD>ѯ' then
begin
BringWindowToTop(frmClothSCListAnPaiJiTaiAPCX.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmClothSCListAnPaiJiTaiAPCX := TfrmClothSCListAnPaiJiTaiAP.Create(application.MainForm);
with frmClothSCListAnPaiJiTaiAPCX do
begin
Title := '<27><>̨<EFBFBD><CCA8><EFBFBD>Ų<EFBFBD>ѯ';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmClothSCListAnPaiJiTaiAPCX.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmClothSCListAnPaiJiTaiAPCX.Handle;
end;
301: //<2F><>Ʊ<EFBFBD><C6B1>ӡ
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><>Ʊ<EFBFBD><C6B1>ӡ' 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 := '<27><>Ʊ<EFBFBD><C6B1>ӡ';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
// DParameters1:=YD;
//show;
end;
end
else
frmClothSCDCGAnPai1.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmClothSCDCGAnPai1.Handle;
end;
401: //<2F>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD>
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;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmClothGMList.Handle;
end;
411: //<2F>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>
begin
if frmCloththList = nil then
begin
frmCloththList := TfrmClothTHList.Create(application.MainForm);
with frmCloththList do
begin
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmCloththList.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmCloththList.Handle;
end;
402: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmMJManageNewFDJJAP.Handle;
end;
501: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>' then
begin
BringWindowToTop(frmJYOrderCDOnePBGL.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
//if frmBaoGuanListBGZL=nil then
begin
frmJYOrderCDOnePBGL := TfrmJYOrderCDOnePB.Create(application.MainForm);
with frmJYOrderCDOnePBGL do
begin
Title := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmJYOrderCDOnePBGL.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmJYOrderCDOnePBGL.Handle;
end;
502: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ' 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 := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ';
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmJYOrderCDOnePBCX.BringToFront;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmJYOrderCDOnePBCX.Handle;
end;
601: //<2F>β<EFBFBD><CEB2><EFBFBD><EFBFBD><EFBFBD>
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;
//<2F><><EFBFBD><EFBFBD>
mnewHandle := frmDcgGzList.Handle;
end;
end;
Result := mnewHandle;
// NewDllApp := Application;
end;
//===========================================================
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>ӳ<EFBFBD>
//===========================================================
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('<27><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><><EFBFBD><EFBFBD>', mb_Ok + MB_ICONERROR);
end;
end;
initialization
CoInitialize(nil);
dxUnitsLoader.Initialize;
finalization
DataLink_WeavingSchedule.Free;
application := NewDllApp;
dxUnitsLoader.Finalize;
end.