⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 民航飞机生产管理系统,实现了飞机定检坚控,小时卡起落卡等的坚控,并能生成工作任务包
💻 CPP
📖 第 1 页 / 共 5 页
字号:
//---------------------------------------------------------------------------
//    生产科管理系统   copyright by zhouguilin 作者:周桂林  2000年7月至
//     主程序
//----------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop

#include "main.h"
#include "control.h"
#include "tiaojian.h"
#include "gk.h"
#include "dayreport.h"
#include "repplane.h"
#include "prevdlg.h"
#include "dm.h"
#include "gkrep.h"
#include "gklist.h"
#include "qrygkset.h"
#include "qryplane.h"
#include "tools.h"
#include "hangcai.h"
#include "dayqryset.h"
#include "ybqry.h"
#include "about.h"
#include "repshebei.h"
#include "rephangcai.h"
#include "apuedit.h"
#include "printdlg.h"
#include "stdio.h"
#include "fhctrl.h"
#include "password.h"
#include "feng.h"

#include "hour.h"
#include "setup.h"

#include "hoursrep.h"
#include "hoursjihao.h"
#include "fhhistoryrep.h"
#include "bzcyb1.h"
#include "yfxsj1.h"
#include "bzcsjtj.h"
#include "hbbzcsj.h"
#include "jiduiyb.h"
#include "nianyue.h"
#include "bzcrect.h"
#include "nianrect.h"
#include "qzny.h"
#include "yfxsjbb2.h"
#include "hbbzcsj.h"
#include "query82.h"
#include "querygk.h"
#include "xyjhrep.h"     //下月计划
#include "nianbacrect.h"  //年度不正常事件直方图
#include <registry.hpp> //注册表
 //油样突变报告单设置
#include "gysjrep.h"
#include "gczled.h"
#include "gczlrep.h"
#include "gczljc.h"
#include "gczlxq.h"
#include "u90card.h"
#include "Umonths.h"
#include "Ucjgzb.h"
#include "cover.h"
#include "Unit24.h"
#include "U82.h"
//主程序main.h
//定检监控程序control.h
//定检条件设置tiaojian.h
//90工卡  gk.h
//飞机日常运营情况   dayreport.h
//飞机日报报表repplane.h
//飞机月报报表设置prevdlg.h
//数据模块dm.h
//90工卡报表     gkrep.h
//90工卡清单报表gklist.h
//90工卡查询qrygkset.h
//飞机月报报表qryplane.h
//工具设备录入tools.h
//航材录入hangcai.h
//飞机日报查询dayqryset.h
//定检监控、小时卡监控ybqry.h
//关于    about.h
//工具设备报表repshebei.h
//航材报表rephangcai.h
//飞机基本参数apuedit.h
//打印选择对话框printdlg.h
//标准输入输出stdio.h
//小时卡监控fhctrl.h
//密码    password.h
//闪烁画面feng.h
//油样标准录入oil.h
//油样录入oiledit.h
//小时卡录入hour.h
//系统设置-输入法setup.h
//油样曲线图打印控制oilctrl.h
//小时卡报表(82定检)hoursrep.h
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "KsSkinForms"
#pragma link "se_controls"
#pragma link "KsSkinSpeedButtons"
#pragma link "KsSkinToolBars"
#pragma link "KsSkinEngine"
#pragma link "KsSkinItems"
#pragma link "KsSkinMenus"
#pragma link "ksskinmessages"
#pragma link "KsSkinButtons"
#pragma link "KsSkinControlBars"
#pragma resource "*.dfm"
TForm1 *Form1;
extern TDataModule1 *DataModule1;  //数据模块
int pass;    //区分是输入密码还是更改密码
bool printbool; //可打印
extern int qidian[20],zongdian[20],rectlength[20],cishu[20],jiange[20];
int iwucha[20];  //误差变量数组
//外部变量,定检监控单元用。依次是定检监控条起点时间、终点时间、矩形条长度、定检次数、定检间隔。
extern TMemo *memo;
//外部变量,定检监控用。该变量可从硬盘上提取机号信息
extern TColor djcolor[20];//同上,控制矩形监控条的颜色
extern AnsiString djming[20],jixing[20]; //定检名称、机型
 AnsiString lujing,bkdir;                //数据库存储路径、备份数据库路径
 int xiuhou[20],jizong[20],jiashu;//修后小时、机身总时间、架数
 bool edit;                      //是否可以修改
 AnsiString shurufa;             //中文输入法,系统通过该变量控制字段的中文输入法。
 extern int fhqidian[100],fhdangqian[100],fhjiange[100];//小时卡控制变量
extern AnsiString fhjihao[100],fhleixing[100]; //小时卡飞机号,小时卡类型
extern TColor fhcolor[100];//小时卡进度条颜色
extern int controlnum,fhcishu[100];          //小卡到期数目,小时卡次数
bool fjyb; //飞机月报
extern AnsiString danwei; //单位名称
extern AnsiString gczlbh[100],gczljh[100],gczlxfrq[100],gczlywrq[100];
extern int gczlfh[100],gczlld[100],gczlldfhdq[100],gczlcount;
extern TColor color[100];
extern int tianshu[20];
extern TDate  qishidate[20];
extern int cjcishu[20];
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Left=5;
Top=2;
fjyb=true;
Width=Screen->Width;
//从注册表获得输入法和单位名称
const String RegKey="SOFTWARE\\sckglxt\\setup";
TRegIniFile* RegFile=new TRegIniFile(RegKey);
shurufa=RegFile->ReadString("ime","chime","");
danwei=RegFile->ReadString("dw","repdw","");
delete RegFile;
//获得数据库存储路径

AnsiString  luj=ExtractFileDir(Application->ExeName);
int ll=luj.Length();
lujing=luj.SubString(1,ll-7);
bkdir=lujing;
lujing=lujing+"DATA\\";
//获得机号信息
memo=new TMemo(Form1->Handle);
memo->Lines->LoadFromFile(lujing+"plane.txt");
jiashu=memo->Lines->Count;
printbool=false;
DataModule1=new TDataModule1(Application);

}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormShow(TObject *Sender)
{
control();//调用定检监控函数
Form2->Show();   //启动定检监控窗
DataModule1->tiaojian->Filtered=false;

fhhourctrl();//调用小时卡监控
gczljk();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::N8_oldClick(TObject *Sender)
{


Application->Terminate();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::I1_oldClick(TObject *Sender)
{
if (I1->Checked)
{
        I1->Checked=0;
        Form2->Close();
        }
else
   {     I1->Checked=-1;
          Form2->Show();
          }
}
//---------------------------------------------------------------------------

void __fastcall TForm1::N12_oldClick(TObject *Sender)
{
 pass=0;
TForm23 *Form23=new TForm23(Application);
Form23->ShowModal(); //调用密码窗
delete Form23;
DataModule1->tiaojian->ReadOnly=!edit;//设置是否可写
Form3->ShowModal();
control();
fhhourctrl();
}
//---------------------------------------------------------------------------


void __fastcall TForm1::N13_oldClick(TObject *Sender)
{
pass=0;
TForm23 *Form23=new TForm23(Application);
Form23->ShowModal();
delete Form23;
DataModule1->dayreport->ReadOnly=!edit;
TForm4* Form4=new TForm4(this);
Form4->BitBtnAdd->Enabled=edit;
Form4->BitBtnEdit->Enabled=edit;
Form4->BitBtnDel->Enabled=edit;
Form4->ShowModal();
delete Form4;

}
//---------------------------------------------------------------------------

void __fastcall TForm1::N10_oldClick(TObject *Sender)
{
pass=0;
TForm23 *Form23=new TForm23(Application);
Form23->ShowModal();
delete Form23;
DataModule1->gk90->ReadOnly=!edit;

Form5->Show();

}
//---------------------------------------------------------------------------


//---------------------------------------------------------------------------

void __fastcall TForm1::N16_oldClick(TObject *Sender)
{
Form15->Caption="飞机日报设置";
Form15->Show();
}
//---------------------------------------------------------------------------


void __fastcall TForm1::N11_oldClick(TObject *Sender)
{
TF90card* f90=new TF90card(this);
f90->ShowModal();
delete f90;

}
//---------------------------------------------------------------------------

void __fastcall TForm1::N17_oldClick(TObject *Sender)
{
if(M1->MessageDlg("是否要保存为电子表格?         ",mtConfirmation, TMsgDlgButtons() << mbYes<<mbNo, 0)==mrNo)
{
TF90card* f90=new TF90card(this);
f90->Tag=1;
f90->ShowModal();
delete f90;}
else
 {
 TForm24 *f24=new TForm24(this);
 f24->ADT=DataModule1->gk90;
 f24->ShowModal();
 delete f24;
 }
}
//---------------------------------------------------------------------------

void __fastcall TForm1::N31_oldClick(TObject *Sender)
{
Form11->Show();
}
//---------------------------------------------------------------------------


void __fastcall TForm1::N26_oldClick(TObject *Sender)
{
pass=0;
TForm23 *Form23=new TForm23(Application);
Form23->ShowModal();
delete Form23;
DataModule1->ajsb->ReadOnly=!edit;
  Form13->Show();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::N27_oldClick(TObject *Sender)
{
pass=0;
TForm23 *Form23=new TForm23(Application);
Form23->ShowModal();
delete Form23;
DataModule1->ajhc->ReadOnly=!edit;
Form14->Show();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::N32_oldClick(TObject *Sender)
{
Form15->Caption="飞机日报查询设置";
Form15->Show();
}
//---------------------------------------------------------------------------



void TForm1::control()
{

//int datacount=DataModule1->dingjian->RecordCount;
AnsiString tj;

for(int i=0;i<jiashu;i++)
{
        tj="机号= '"+memo->Lines->Strings[i]+"' AND ";
        DataModule1->dingjian->Filtered=false;
        DataModule1->dingjian->Filter=tj+"备注 ='新' AND 定检名称 = 'A'";
        DataModule1->dingjian->Filtered=true;
       
  DataModule1->dingjian->First();
        qidian[i]=DataModule1->djzongshijian->AsInteger/60;
        cishu[i]= DataModule1->djcishu->AsInteger;
        djming[i]=DataModule1->mingcheng->AsString;
        jixing[i]=DataModule1->djjixing->AsString;
}

//  DataModule1->dayreport->AddIndex("jishenindex","机身总",opt,"","",1);
  DataModule1->dayreport->IndexFieldNames="机身总";
  int nowFH[20],oldFH[20];
for(int i=0;i<jiashu;i++)
{

         DataModule1->dayreport->Filtered=false;
         DataModule1->dayreport->Filter="机号 = '"+memo->Lines->Strings[i]+"'";
         DataModule1->dayreport->Filtered=true;
        DataModule1->dayreport->IndexFieldNames="机身总";
         DataModule1->dayreport->UpdateStatus();
         DataModule1->dayreport->Last();
         nowFH[i]=DataModule1->dayreportField4->AsInteger/60;
         rectlength[i]=DataModule1->dayreportField4->AsInteger/60-qidian[i];
         xiuhou[i]=DataModule1->dayreportField3->AsInteger;
          jizong[i]=DataModule1->dayreportField4->AsInteger;

}
for(int i=0;i<jiashu;i++)
{
        tj="机号= '"+memo->Lines->Strings[i]+"' AND ";
        DataModule1->dingjian->Filtered=false;
        DataModule1->dingjian->Filter=tj+"备注 ='新' AND 定检名称 = 'C'";
        DataModule1->dingjian->Filtered=true;
        qishidate[i]=DataModule1->dingjian->Fields->FieldByName("日期")->AsDateTime;
        cjcishu[i]=DataModule1->dingjian->Fields->FieldByName("次数")->AsInteger;
        oldFH[i]=DataModule1->dingjian->Fields->FieldByName("总时间")->AsInteger/60;
        TDate tmp=Now();
        tianshu[i]=abs(450-(tmp-qishidate[i]));
        int t=(nowFH[i]-oldFH[i])/8;
        tianshu[i]=tianshu[i]<=t?tianshu[i]:t;

}
int shul;
for(int i=0;i<jiashu;i++)
{
    DataModule1->tiaojian->Filtered=false;
    DataModule1->tiaojian->Filter="定检名称 = '"+djming[i]+"' AND 机型 = '"+jixing[i]+"'";
    DataModule1->tiaojian->Filtered=true;
    shul=DataModule1->tiaojian->RecordCount;
    iwucha[i]=DataModule1->tiaojianField3->AsInteger;

    jiange[i]= DataModule1->tiaojianField2->AsInteger;
    if(jiange[i]==0)
        jiange[i]=450;
    zongdian[i]=qidian[i]+jiange[i];
int tixing=jiange[i]-DataModule1->tiaojianField4->AsInteger;
int wucha=jiange[i]-DataModule1->tiaojianField3->AsInteger;

        if(rectlength[i]<tixing)
        djcolor[i]=clGreen;
        else   {
                if(rectlength[i]<wucha)

                djcolor[i]=clYellow;

                else
                djcolor[i]=clRed;
                if(!Form2->Showing)
                Form2->Show();
               }
}
     DataModule1->dingjian->Filtered=false;   //TODO: Add your source code here
     DataModule1->tiaojian->Filtered=false;
}
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
delete memo;             
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -