📄 shfwmain.~cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#include <stdio.h>
#include <dir.h>
#pragma hdrstop
#include <IniFiles.hpp>
#include "ShFwMain.h"
#include "Login.h"
#include "RyGl.h"
#include "SpSetGl.h"
#include "BjGl.h"
#include "BjLs.h"
#include "BjWj.h"
#include "PathSetup.h"
#include "FwSl.h"
#include "Passwd.h"
#include "getfwclqd.h"
#include "gysjs.h"
#include "fwryjs.h"
#include "About.h"
#include "PjSet.h"
#include "khgl.h"
#include "FwPgcl.h"
#include "FwJscl.h"
#include "FwHfcl.h"
#include "SetFwQkxx.h"
#include "GgSet.h"
#include "GysSet.h"
#include "PjclMx.h"
#include "FwFx.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TMainForm *MainForm;
//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::N6Click(TObject *Sender)
{
TRyGlForm *RyGlForm;
try
{
RyGlForm = new TRyGlForm(Application);
RyGlForm->ShowModal();
delete RyGlForm;
}
catch(...)
{
delete RyGlForm;
Application->MessageBox("运行出现错误!","警告",MB_OK+MB_ICONWARNING);
}
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::FormClose(TObject *Sender, TCloseAction &Action)
{
ADOConnection1->Close();
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::N7Click(TObject *Sender)
{
TSpSetForm *SpSetForm;
try
{
SpSetForm = new TSpSetForm(Application);
SpSetForm->ShowModal();
delete SpSetForm;
}
catch(...)
{
delete SpSetForm;
Application->MessageBox("运行出现错误!","警告",MB_OK+MB_ICONWARNING);
}
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::FormCreate(TObject *Sender)
{
DWORD BufSize = MAX_PATH + 1;
char buffer[MAX_PATH + 1];
AnsiString def,Imagepath,IniFileName;
AnsiString cap = Application->Title; //获取程序标题保存到cap
Application->Title = "xwin server temp"; //修改标题以防找到自己
if( FindWindow( NULL,cap.c_str()) ) { //查找是否运行过此程序
Application->Terminate(); //是,就终止程序运行
return;
}
Application->Title = cap.c_str(); //恢复程序标题
if( ! GetCurrentDirectory( BufSize,buffer )) { //获取当前工作目录
Application->MessageBox("获取当前工作目录出现错误!","警告",MB_OK+MB_ICONWARNING);
Application->Terminate();
return;
}
MainForm->CurDir = String(buffer).Trim();
IniFileName = MainForm->CurDir + "\\Config.ini";
TIniFile *IniFile = new TIniFile( IniFileName.c_str());
MainForm->MDBPATH = IniFile->ReadString( "PathInfo", "dbpath", def);
MainForm->MyGsMc = IniFile->ReadString( "PathInfo", "GsMc", def);
MainForm->MyCxSum = IniFile->ReadInteger( "PathInfo", "CxSum", 90);
delete IniFile;
if(MainForm->MDBPATH.Trim()=="" || FileExists(MainForm->MDBPATH)== false ) {
if(Application->MessageBox("无法打开数据源路径,是否进行设置?","确认",MB_OKCANCEL+MB_ICONERROR)!=IDOK) {
Application->Terminate();
return;
}
TPathForm *PathForm;
try
{
PathForm = new TPathForm(Application);
PathForm->ShowModal();
delete PathForm;
}
catch(...)
{
delete PathForm;
Application->MessageBox("运行出现错误!","警告",MB_OK+MB_ICONWARNING);
}
if(MainForm->MDBPATH.Trim()=="" || FileExists(MainForm->MDBPATH)== false ) {
Application->Terminate();
return;
}
}
ADOConnection1->Close();
ADOConnection1->ConnectionString ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+MainForm->MDBPATH+";Mode=ReadWrite;Persist Security Info=False";
TLoginForm *LoginForm;
LoginFlag = false;
try
{
LoginForm = new TLoginForm(Application);
LoginForm->ShowModal();
delete LoginForm;
}
catch(...)
{
delete LoginForm;
Application->MessageBox("运行出现错误!","警告",MB_OK+MB_ICONWARNING);
Application->Terminate();
return;
}
if ( LoginFlag == false ) {
Close();
Application->Terminate();
return;
}
if( fwslqx =="有") { //受理
N19->Enabled = true;
N24->Enabled = true; //客户管理
SpeedButton1->Enabled = true;
}else{
N19->Enabled = false;
N24->Enabled = false;
SpeedButton1->Enabled = false;
}
if( fwpgqx =="有"){ //派工
N20->Enabled = true;
SpeedButton5->Enabled = true;
} else {
N20->Enabled = false;
SpeedButton5->Enabled = false;
}
if( fwjsqx =="有") { //结算
N21->Enabled = true;
SpeedButton2->Enabled = true;
} else {
N21->Enabled = false;
SpeedButton2->Enabled = false;
}
if( hfjsqx =="有") { //回访结算
N22->Enabled = true;
SpeedButton6->Enabled = true;
} else {
N22->Enabled = false;
SpeedButton6->Enabled = false;
}
if( pjglqx =="有") { //配件管理
N9->Enabled = true;
N10->Enabled = true;
N11->Enabled = true;
} else {
N9->Enabled = false;
N10->Enabled = false;
N11->Enabled = false;
}
if( cxqx =="有") { //保密信息
N12->Enabled = true;
N13->Enabled = true;
N14->Enabled = true;
N27->Enabled = true;
} else {
N12->Enabled = false;
N13->Enabled = false;
N14->Enabled = false;
N27->Enabled = false;
}
Imagepath = MainForm->CurDir + "\\MainPict.jpg";
if ( FileExists( Imagepath )== true )
Image1->Picture->LoadFromFile(Imagepath);
else
Application->MessageBox("装入背景文件出现错误","警告",MB_OK+MB_ICONWARNING);
if( MainForm->MyGsMc.Trim()!="") {
Label1->AutoSize = false;
Label1->Caption = MainForm->MyGsMc + "售后服务管理系统";
}
AnsiString TimeMsg;
TSystemTime stTime;
GetLocalTime( &stTime );
TimeMsg = FormatDateTime("dddddd dddd", SystemTimeToDateTime( stTime));
Label3->Caption = TimeMsg;
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::N8Click(TObject *Sender)
{
TPathForm *PathForm;
try
{
PathForm = new TPathForm(Application);
PathForm->ShowModal();
delete PathForm;
}
catch(...)
{
delete PathForm;
Application->MessageBox("运行出现错误!","警告",MB_OK+MB_ICONWARNING);
}
if( MainForm->MyGsMc.Trim()!="") {
Label1->AutoSize = false;
Label1->Caption = MainForm->MyGsMc + "售后服务管理系统";
}
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::N9Click(TObject *Sender)
{
TBjGlForm *BjGlForm;
try
{
BjGlForm = new TBjGlForm(Application);
BjGlForm->ShowModal();
delete BjGlForm;
}
catch(...)
{
delete BjGlForm;
Application->MessageBox("运行出现错误!","警告",MB_OK+MB_ICONWARNING);
}
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::N10Click(TObject *Sender)
{
TBjLsForm *BjLsForm;
try
{
BjLsForm = new TBjLsForm(Application);
BjLsForm->ShowModal();
delete BjLsForm;
}
catch(...)
{
delete BjLsForm;
Application->MessageBox("运行出现错误!","警告",MB_OK+MB_ICONWARNING);
}
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::N11Click(TObject *Sender)
{
TBjWjForm *BjWjForm;
try
{
BjWjForm = new TBjWjForm(Application);
BjWjForm->ShowModal();
delete BjWjForm;
}
catch(...)
{
delete BjWjForm;
Application->MessageBox("运行出现错误!","警告",MB_OK+MB_ICONWARNING);
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -