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

📄 control.cpp

📁 民航飞机生产管理系统,实现了飞机定检坚控,小时卡起落卡等的坚控,并能生成工作任务包
💻 CPP
📖 第 1 页 / 共 2 页
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "control.h"
#include "main.h"
#include "wizard.h"
#include "password.h"
#include "dm.h"
#include "Ucjgzb.h"
#include "cover.h"
#include "hoursrep.h"
#include "repshebei.h"
#include "rephangcai.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "KsSkinForms"
#pragma link "se_controls"
#pragma resource "*.dfm"
TForm2 *Form2;
 TMemo *memo;
 TColor djcolor[20];
int qidian[20];
int zongdian[20];
int rectlength[20];
int cishu[20];
int jiange[20];
AnsiString djming[20],jixing[20];
extern    AnsiString lujing,jihao;
int plane;
extern int pass;
extern bool edit;
int tianshu[20];
TDate qishidate[20];
int cjcishu[20];
const cjwucha=30;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm2::FormCreate(TObject *Sender)
{
Left=5;
Top=Form1->Height;
Height=Screen->Height-Top;


maxcount=memo->Lines->Count;


int cellheight=(int)Height/(maxcount+1);
        //Canvas->Brush->Color=clBlack;
        //Canvas->Font= "楷体_GB2312";
        Canvas->Font->Size=12;
for(int i=0;i<maxcount;i++)
{

        Canvas->TextOutA(10,10+i*cellheight,memo->Lines->Strings[i]);
}
}
//---------------------------------------------------------------------------

void __fastcall TForm2::FormClose(TObject *Sender, TCloseAction &Action)
{
if (Form1->I1->Checked) Form1->I1->Checked=0;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FormPaint(TObject *Sender)
{
int cellheight=int((Height-10)/(maxcount+1));
       Canvas->Brush->Color=clBtnFace;
        Canvas->Font->Name = "宋体";
        Canvas->Font->Size=8;
for(int i=0;i<maxcount;i++)
{
        Canvas->Font->Color=clBlue;
        if(rectlength[i]<=1)
        Canvas->TextOutA(10,10+i*cellheight,memo->Lines->Strings[i]+"飞机正在做"+IntToStr(cishu[i])+djming[i]+"检");
        else
        {
        if(memo->Lines->Strings[i]>"2200")
        Canvas->TextOutA(10,10+i*cellheight,memo->Lines->Strings[i]+"飞机距"+IntToStr(cishu[i]%100+1)+djming[i]+"检还有"+IntToStr(jiange[i]-rectlength[i])+"小时");
        else
        Canvas->TextOutA(10,10+i*cellheight,memo->Lines->Strings[i]+"飞机距"+IntToStr(cishu[i]%8+1)+djming[i]+"检还有"+IntToStr(jiange[i]-rectlength[i])+"小时");
        }
        Canvas->Rectangle(10,25+i*cellheight,Width-20,35+i*cellheight);
        Canvas->Font->Color=clPurple;
        Canvas->TextOutA(10,35+i*cellheight,IntToStr(qidian[i]));
        Canvas->TextOutA(Width-50,35+i*cellheight,IntToStr(zongdian[i]));
        Canvas->Font->Color=clRed;
        
       // if(memo->Lines->Strings[i]>"2200")
        //{
        Canvas->TextOutA(11,46+i*cellheight,DateToStr(qishidate[i]));
        Canvas->TextOutA(80,46+i*cellheight,"距"+IntToStr(cjcishu[i]%8+1)+"C检还有"+IntToStr(tianshu[i])+"天");
        // }
     }

     for(int i=0;i<maxcount;i++)
{      Canvas->Brush->Color=djcolor[i];
      if(rectlength[i]<=1)
      continue;
      Canvas->FillRect(Rect(11,26+i*cellheight,int(rectlength[i]*(Width-30)/jiange[i]),34+i*cellheight));


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


void __fastcall TForm2::FormMouseDown(TObject *Sender, TMouseButton Button,
      TShiftState Shift, int X, int Y)
{
plane=int((Y-10)/int(((Height-10)/(maxcount+1))));
jihao=memo->Lines->Strings[plane];
int dqcishu;
 if(memo->Lines->Strings[plane]>"2200")
        dqcishu=cishu[plane]%100+1;
        else
        dqcishu=cishu[plane]%8+1;
if(tianshu[plane]<cjwucha)
{
         if(MessageDlg(memo->Lines->Strings[plane]+"飞机距"+IntToStr(cjcishu[plane]%8+1)+"C检+"+IntToStr(dqcishu)+djming[plane]+"检进入误差范围之内,现在做准备工作吗?", mtWarning, TMsgDlgButtons() << mbYes<<mbNo,  0) == mrYes)
                 {
                      if(jihao>"2200")
                      {
                     pass=0;
                        TForm23 *Form23=new TForm23(Application);
                        Form23->ShowModal();
                        delete Form23;
                     if(edit)
                        {
                            Form17->ShowModal();

                         }
                       }
                       else
                       {
//md82 C检工作包

                        TDate cjdate;
                        TFcjgzb* f=new TFcjgzb(this);
                        f->jh->Text=jihao;
                        f->jx->Text="MD82";
                        f->ComboLeiBie->Text=IntToStr(cjcishu[plane]+1);
                        TMemo *memo=new TMemo(Handle);
                         TMemo *memo1=new TMemo(Handle);
                           TMemo *memo2=new TMemo(Handle);
                         memo->Lines->LoadFromFile(lujing+"lefteng.txt");
                         memo1->Lines->LoadFromFile(lujing+"righteng.txt");
                          memo2->Lines->LoadFromFile(lujing+"apusn.txt");
                        f->zfxh->Text=memo->Lines->Strings[plane];
                        f->yfxh->Text=memo1->Lines->Strings[plane];
                         f->apuxh->Text=memo2->Lines->Strings[plane];
                         delete memo2;
                           delete memo1;
                           delete memo;

                        DataModule1->dayreport->Filtered=false;
                        DataModule1->dayreport->Filter="机号 = '"+jihao+"'";
                        DataModule1->dayreport->Filtered=true;
                        //DataModule1->dayreport->IndexName="jishenindex";
                        f->fh->Text=FormatFloat("#####.##",zongdian[plane]);
                        int tian=int((zongdian[plane]-DataModule1->dayreportField4->AsInteger/60)/8);
                        f->zfh->Text=FormatFloat("#####.##",(DataModule1->dayreportField6->AsInteger+tian*8)/60);
                        f->yfh->Text=FormatFloat("#####.##",(DataModule1->dayreportField8->AsInteger+tian*8)/60);
                        f->ql->Text=IntToStr(DataModule1->dayreportField10->AsInteger+tian*6);
                        f->apuh->Text=IntToStr(DataModule1->dayreportAPU->AsInteger+tian*4);
                        f->zxh->Text=IntToStr(DataModule1->dayreportField11->AsInteger+tian*6);
                        f->yxh->Text=IntToStr(DataModule1->dayreportField12->AsInteger+tian*6);
                        f->ShowModal();
                        if(f->ModalResult==mrOk)
                        {
                         TForm21 *fcover=new TForm21(this);
                         fcover->bianhao->Caption=f->EdtBh->Text;
                         //fcover->QRMemo1->Lines->Text=f->RenWu->Lines->Text;
                         fcover->zfxh->Caption=f->zfxh->Text;
                         fcover->yfxh->Caption=f->yfxh->Text;
                         fcover->apuxh->Caption=f->apuxh->Text;
                         fcover->fh->Caption=f->fh->Text;
                         fcover->le->Caption=f->zfh->Text;
                         fcover->re->Caption=f->yfh->Text;
                         fcover->apu->Caption=f->apuh->Text;
                         fcover->ql->Caption=f->ql->Text;
                         fcover->lc->Caption=f->zxh->Text;
                         fcover->rc->Caption=f->yxh->Text;
                         AnsiString rw=f->jx->Text+"飞机";
                         rw+=f->jh->Text+"自";
                         int ts=StrToInt(f->EdtTs->Text);
                         TDate rq=StrToDate(f->EdtRq->Text);
                         cjdate=rq;
                         TDate rq2=rq+ts;
                         Word Year, Month, Day;
                         DecodeDate(rq, Year, Month, Day);
                         rw+=IntToStr(Year)+"年"+IntToStr(Month)+"月"+IntToStr(Day)+"日至";
                         fcover->QRLabel39->Caption=IntToStr(Year)+"年";
                         fcover->QRLabel40->Caption=IntToStr(Month)+"月";
                         fcover->QRLabel41->Caption=IntToStr(Day)+"日";
                        DecodeDate(rq2, Year, Month, Day);
                         rw+=IntToStr(Year)+"年"+IntToStr(Month)+"月"+IntToStr(Day)+"日";
                         if(f->TingChang->ItemIndex==0)
                         rw+="停场";
                         else
                         rw+="分段";
                         fcover->QRLabel42->Caption=IntToStr(Year)+"年";
                         fcover->QRLabel43->Caption=IntToStr(Month)+"月";
                         fcover->QRLabel44->Caption=IntToStr(Day)+"日";
                         fcover->QRLabel47->Caption=IntToStr(ts)+"天完成\n"+f->ComboLeiBie->Text+"C";
                         rw+=fcover->QRLabel47->Caption+"检工作";
                         fcover->QRMemo1->Lines->Text=rw;
                         fcover->QuickRep1->Preview();
                         delete fcover;
                        AnsiString jx=f->jx->Text;
                        int leibie=StrToInt(f->ComboLeiBie->Text);
                        AnsiString tj="((类型 = 'D') or (间隔='30')) OR (类型= 'A') OR ((类型 = 'C') ";
                        if(jx=="MD82")
                                {
                        switch(leibie)
                                {
                                case 1:
                                        {
                                        tj+="AND (间隔= '1') )";
                                        break;
                                        }
                                case 2:
                                         {
                                        tj+=" AND ((间隔= '1') OR (间隔='2')))";
                                        break;
                                        }
                                case 3:
                                                {
                                         tj+=" AND ((间隔= '1') OR (间隔='3')))";
                                        break;
                                        }

⌨️ 快捷键说明

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