📄 formmgr.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "FormMgr.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
TModuleForm::TModuleForm()
{
hCommInst=NULL; //Common Data document
hCaphInst=NULL; //Capacity
hCmhInst=NULL; //Cost
hCmdInst=NULL; //Cost Document
hEmhInst=NULL; //Equipment
hEmdInst=NULL; //Equip Document
hFmhInst=NULL; //Finance
hFmdInst=NULL; //Finance document
hHmhInst=NULL; //Human
hHmdInst=NULL; //Human Document
hImhInst=NULL; //Inventory
hImdInst=NULL; //Inventory document
hMmhInst=NULL; //Manufactory
hMmdInst=NULL; //Manufactory document
hPlnhInst=NULL; //Plan
hPlndInst=NULL; //Plan Document
hPmhInst=NULL; //Purchase
hPmdInst=NULL; //Purchase document
hQmhInst=NULL; //Quality
hQmdInst=NULL; //Quality document
hQryInst=NULL; //Query
hRptInst=NULL; //Report
hSmhInst=NULL; //Sale
hSmdInst=NULL; //Sale document
hSysInst=NULL;
}
TModuleForm::~TModuleForm()
{
if(hCommInst!=NULL)
FreeLibrary(hCommInst); //Common Data document
if(hCaphInst!=NULL)
FreeLibrary(hCaphInst); //Capacity
if(hCmhInst!=NULL)
FreeLibrary(hCmhInst); //Cost
if(hCmdInst!=NULL)
FreeLibrary(hCmdInst); //Cost Document
if(hEmhInst!=NULL)
FreeLibrary(hEmhInst); //Equipment
if(hEmdInst!=NULL)
FreeLibrary(hEmdInst); //Equip Document
if(hFmhInst!=NULL)
FreeLibrary(hFmhInst); //Finance
if(hFmdInst!=NULL)
FreeLibrary(hFmdInst); //Finance document
if(hHmhInst!=NULL)
FreeLibrary(hHmhInst); //Human
if(hHmdInst!=NULL)
FreeLibrary(hHmdInst); //Human Document
if(hImhInst!=NULL)
FreeLibrary(hImhInst); //Inventory
if(hImdInst!=NULL)
FreeLibrary(hImdInst); //Inventory document
if(hMmhInst!=NULL)
FreeLibrary(hMmhInst); //Manufactory
if(hMmdInst!=NULL)
FreeLibrary(hMmdInst); //Manufactory document
if(hPlnhInst!=NULL)
FreeLibrary(hPlnhInst); //Plan
if(hPlndInst!=NULL)
FreeLibrary(hPlndInst); //Plan Document
if(hPmhInst!=NULL)
FreeLibrary(hPmhInst); //Purchase
if(hPmdInst!=NULL)
FreeLibrary(hPmdInst); //Purchase document
if(hQmhInst!=NULL)
FreeLibrary(hQmhInst); //Quality
if(hQmdInst!=NULL)
FreeLibrary(hQmdInst); //Quality document
if(hQryInst!=NULL)
FreeLibrary(hQryInst); //Query
if(hRptInst!=NULL)
FreeLibrary(hRptInst); //Report
if(hSmhInst!=NULL)
FreeLibrary(hSmhInst); //Sale
if(hSmdInst!=NULL)
FreeLibrary(hSmdInst); //Sale document
if(hSysInst!=NULL)
FreeLibrary(hSysInst);
}
void TModuleForm::InitModuleForm(TIComServer *IComServer,
TIComResultSet *IComResultSet,TComResultSet *RsGoods,
TComResultSet *RsGlkm)
{
g_IComServer=IComServer;
g_ClientComm=g_IComServer->ClientComm;
g_IComResultSet=IComResultSet;
g_sdRsGoods=RsGoods;
g_sdRsGlkm=RsGlkm;
// Application->Handle=g_ClientComm->App->Handle;
}
TForm * TModuleForm::NewModuleForm(AnsiString FormCode,int FormLib,int FormRight)
{
try
{
switch(FormLib)
{
case 10101:
if(hSysInst==NULL)
{
hSysInst=LoadLibrary("sdSysMgr.DLL");
if(hSysInst==NULL)
throw Exception("装载文件SdSysMgr.dll失败!");
(FARPROC)InitClientModule=GetProcAddress(hSysInst,"InitModuleVar");
if(InitClientModule==NULL)
throw Exception("设置模块数据函数失败!");
InitClientModule(g_IComServer,g_IComResultSet,g_sdRsGoods,g_sdRsGlkm);
(FARPROC)NewSystemForm=GetProcAddress(hSysInst,"NewClientForm");
if(NewSystemForm==NULL)
throw Exception("设置创建窗体函数失败!");
}
return NewSystemForm(FormCode,FormRight);
case 10301:
if(hCommInst==NULL)
{
hCommInst=LoadLibrary("sdCommData.DLL");
if(hCommInst==NULL)
throw Exception("装载文件SdCommData.dll失败!");
(FARPROC)InitClientModule=GetProcAddress(hCommInst,"InitModuleVar");
if(InitClientModule==NULL)
throw Exception("设置模块数据函数失败!");
InitClientModule(g_IComServer,g_IComResultSet,g_sdRsGoods,g_sdRsGlkm);
(FARPROC)NewCommDataForm=GetProcAddress(hCommInst,"NewClientForm");
if(NewCommDataForm==NULL)
throw Exception("设置创建窗体函数失败!");
}
return NewCommDataForm(FormCode,FormRight);
case 10401:
if(hPmdInst==NULL)
{
hPmdInst=LoadLibrary("SdPurDoc.DLL");
if(hPmdInst==NULL)
throw Exception("装载文件sdpurdoc.dll失败!");
(FARPROC)InitClientModule=GetProcAddress(hPmdInst,"InitModuleVar");
if(InitClientModule==NULL)
throw Exception("设置模块数据函数失败!");
InitClientModule(g_IComServer,g_IComResultSet,g_sdRsGoods,g_sdRsGlkm);
(FARPROC)NewPurDocForm=GetProcAddress(hPmdInst,"NewClientForm");
if(NewPurDocForm==NULL)
throw Exception("设置创建窗体函数失败!");
}
return NewPurDocForm(FormCode,FormRight);
case 10402:
if(hPmhInst==NULL)
{
hPmhInst=LoadLibrary("sdpurchase.dll");
if(hPmhInst==NULL)
throw Exception("装载文件sdpurchase.dll失败!");
(FARPROC)InitClientModule=GetProcAddress(hPmhInst,"InitModuleVar");
if(InitClientModule==NULL)
throw Exception("设置模块数据函数失败!");
InitClientModule(g_IComServer,g_IComResultSet,g_sdRsGoods,g_sdRsGlkm);
(FARPROC)NewPurchaseForm=GetProcAddress(hPmhInst,"NewClientForm");
if(NewPurchaseForm==NULL)
throw Exception("设置创建窗体函数失败!");
}
return NewPurchaseForm(FormCode,FormRight);
case 10501:
if(hSmdInst==NULL)
{
hSmdInst=LoadLibrary("sdsaledoc.dll");
if(hSmdInst==NULL)
throw Exception("装载文件sdsaledoc失败!");
(FARPROC)InitClientModule=GetProcAddress(hSmdInst,"InitModuleVar");
if(InitClientModule==NULL)
throw Exception("设置模块数据函数失败!");
InitClientModule(g_IComServer,g_IComResultSet,g_sdRsGoods,g_sdRsGlkm);
(FARPROC)NewSaleDocForm=GetProcAddress(hSmdInst,"NewClientForm");
if(NewSaleDocForm==NULL)
throw Exception("设置创建窗体函数失败!");
}
return NewSaleDocForm(FormCode,FormRight);
case 10502:
if(hSmhInst==NULL)
{
hSmhInst=LoadLibrary("sdsale.dll");
if(hSmhInst==NULL)
throw Exception("装载文件sdsale.dll失败!");
(FARPROC)InitClientModule=GetProcAddress(hSmhInst,"InitModuleVar");
if(InitClientModule==NULL)
throw Exception("设置模块数据函数失败!");
InitClientModule(g_IComServer,g_IComResultSet,g_sdRsGoods,g_sdRsGlkm);
(FARPROC)NewSaleForm=GetProcAddress(hSmhInst,"NewClientForm");
if(NewSaleForm==NULL)
throw Exception("设置创建窗体函数失败!");
}
return NewSaleForm(FormCode,FormRight);
case 10601:
if(hMmdInst==NULL)
{
hMmdInst=LoadLibrary("sdmakedoc.dll");
if(hMmdInst==NULL)
throw Exception("装载文件sdmakedoc.dll失败!");
(FARPROC)InitClientModule=GetProcAddress(hMmdInst,"InitModuleVar");
if(InitClientModule==NULL)
throw Exception("设置模块数据函数失败!");
InitClientModule(g_IComServer,g_IComResultSet,g_sdRsGoods,g_sdRsGlkm);
(FARPROC)NewMakeDocForm=GetProcAddress(hMmdInst,"NewClientForm");
if(NewMakeDocForm==NULL)
throw Exception("设置创建窗体函数失败!");
}
return NewMakeDocForm(FormCode,FormRight);
case 10602:
if(hMmhInst==NULL)
{
hMmhInst=LoadLibrary("sdmake.dll");
if(hMmhInst==NULL)
throw Exception("装载文件sdmake.dll失败!");
(FARPROC)InitClientModule=GetProcAddress(hMmhInst,"InitModuleVar");
if(InitClientModule==NULL)
throw Exception("设置模块数据函数失败!");
InitClientModule(g_IComServer,g_IComResultSet,g_sdRsGoods,g_sdRsGlkm);
(FARPROC)NewMakeForm=GetProcAddress(hMmhInst,"NewClientForm");
if(NewMakeForm==NULL)
throw Exception("设置创建窗体函数失败!");
}
return NewMakeForm(FormCode,FormRight);
case 10701:
if(hImdInst==NULL)
{
hImdInst=LoadLibrary("sdinvdoc.dll");
if(hImdInst==NULL)
throw Exception("装载文件sdinvdoc.dll失败!");
(FARPROC)InitClientModule=GetProcAddress(hImdInst,"InitModuleVar");
if(InitClientModule==NULL)
throw Exception("设置模块数据函数失败!");
InitClientModule(g_IComServer,g_IComResultSet,g_sdRsGoods,g_sdRsGlkm);
(FARPROC)NewInvDocForm=GetProcAddress(hImdInst,"NewClientForm");
if(NewInvDocForm==NULL)
throw Exception("设置创建窗体函数失败!");
}
return NewInvDocForm(FormCode,FormRight);
case 10702:
if(hImhInst==NULL)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -