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

📄 oiledit.cpp

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

#include <vcl.h>
#pragma hdrstop

#include "oiledit.h"
#include "dm.h"
#include "main.h"
#include "Ubcxtj.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm25 *Form25;
extern AnsiString lujing;
extern TDataSet* cxb;
//---------------------------------------------------------------------------
__fastcall TForm25::TForm25(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm25::DateTimePicker1Change(TObject *Sender)
{
DataModule1->oilDateField->AsDateTime = DateTimePicker1->Date;
}
//---------------------------------------------------------------------------

void __fastcall TForm25::FormCreate(TObject *Sender)
{
Left=215;
Top=80;
TMemo *memo=new TMemo(Panel1->Handle);
memo->Lines->LoadFromFile(lujing+"plane.txt");
jihao->Items->Clear();
for(int i=0;i<memo->Lines->Count;i++)
{
jihao->Items->Add(memo->Lines->Strings[i]);
}
delete memo;
}
//---------------------------------------------------------------------------


void TForm25::overstand()
{
TMemo *m1=new TMemo(Panel1->Handle);
try
{
if(jixing->Text=="MD82"&&leixing->Text=="滑油")
{
        m1->Lines->LoadFromFile(lujing+"oil82.txt");
}
if(jixing->Text=="MD82"&&leixing->Text=="液压油")
{
        m1->Lines->LoadFromFile(lujing+"hydr82.txt");
}
if(jixing->Text=="MD90"&&leixing->Text=="滑油")
{
        m1->Lines->LoadFromFile(lujing+"oil90.txt");
}
if(jixing->Text=="MD90"&&leixing->Text=="液压油")
{
        m1->Lines->LoadFromFile(lujing+"hydr90.txt");
}
if(jixing->Text=="")
return;
for(int i=0;i<m1->Lines->Count;i++)
if(m1->Lines->Strings[i]=="")
        m1->Lines->Strings[i]="0.0";
if(StrToFloat(fe->Text)>StrToFloat(m1->Lines->Strings[0]))
{
        fe->Font->Color=clRed;
        Lfe->Font->Color=clRed;
        Lfe->Caption=FloatToStr(StrToFloat(fe->Text)-StrToFloat(m1->Lines->Strings[0]));
}
else
{
fe->Font->Color=clGreen;
Lfe->Font->Color=clGreen;
Lfe->Caption="OK";
}
if(StrToFloat(cu->Text)>StrToFloat(m1->Lines->Strings[1]))
{
        cu->Font->Color=clRed;
        Lcu->Font->Color=clRed;
        Lcu->Caption=FloatToStr(StrToFloat(cu->Text)-StrToFloat(m1->Lines->Strings[1]));
}
else
{
cu->Font->Color=clGreen;
Lcu->Font->Color=clGreen;
Lcu->Caption="OK";
}
if(StrToFloat(ti->Text)>StrToFloat(m1->Lines->Strings[2]))
{
        ti->Font->Color=clRed;
        Lti->Font->Color=clRed;
        Lti->Caption=FloatToStr(StrToFloat(ti->Text)-StrToFloat(m1->Lines->Strings[2]));
}
else
{
ti->Font->Color=clGreen;
Lti->Font->Color=clGreen;
Lti->Caption="OK";
}
if(StrToFloat(ag->Text)>StrToFloat(m1->Lines->Strings[3]))
{
        ag->Font->Color=clRed;
        Lag->Font->Color=clRed;
        Lag->Caption=FloatToStr(StrToFloat(ag->Text)-StrToFloat(m1->Lines->Strings[3]));
}
else
{
ag->Font->Color=clGreen;
Lag->Font->Color=clGreen;
Lag->Caption="OK";
}
if(StrToFloat(mg->Text)>StrToFloat(m1->Lines->Strings[4]))
{
        mg->Font->Color=clRed;
        Lmg->Font->Color=clRed;
        Lmg->Caption=FloatToStr(StrToFloat(mg->Text)-StrToFloat(m1->Lines->Strings[4]));
}
else
{
mg->Font->Color=clGreen;
Lmg->Font->Color=clGreen;
Lmg->Caption="OK";
}
if(StrToFloat(cr->Text)>StrToFloat(m1->Lines->Strings[5]))
{
        cr->Font->Color=clRed;
        Lcr->Font->Color=clRed;
        Lcr->Caption=FloatToStr(StrToFloat(cr->Text)-StrToFloat(m1->Lines->Strings[5]));
}
else
{
cr->Font->Color=clGreen;
Lcr->Font->Color=clGreen;
Lcr->Caption="OK";
}
if(StrToFloat(si->Text)>StrToFloat(m1->Lines->Strings[6]))
{
        si->Font->Color=clRed;
        Lsi->Font->Color=clRed;
        Lsi->Caption=FloatToStr(StrToFloat(si->Text)-StrToFloat(m1->Lines->Strings[6]));
}
else
{
si->Font->Color=clGreen;
Lsi->Font->Color=clGreen;
Lsi->Caption="OK";
}
if(StrToFloat(ni->Text)>StrToFloat(m1->Lines->Strings[7]))
{
        ni->Font->Color=clRed;
        Lni->Font->Color=clRed;
        Lni->Caption=FloatToStr(StrToFloat(ni->Text)-StrToFloat(m1->Lines->Strings[7]));
}
else
{
ni->Font->Color=clGreen;
Lni->Font->Color=clGreen;
Lni->Caption="OK";
}
if(StrToFloat(al->Text)>StrToFloat(m1->Lines->Strings[8]))
{
        al->Font->Color=clRed;
        Lal->Font->Color=clRed;
        Lal->Caption=FloatToStr(StrToFloat(al->Text)-StrToFloat(m1->Lines->Strings[8]));
}
else
{
al->Font->Color=clGreen;
Lal->Font->Color=clGreen;
Lal->Caption="OK";
}
if(StrToFloat(niandu->Text)>StrToFloat(m1->Lines->Strings[9]))
{
        niandu->Font->Color=clRed;
        Lnian->Font->Color=clRed;
        Lnian->Caption=FloatToStr(StrToFloat(niandu->Text)-StrToFloat(m1->Lines->Strings[9]));
}
else
{
niandu->Font->Color=clGreen;
Lnian->Font->Color=clGreen;
Lnian->Caption="OK";
}
if(StrToFloat(suanzhi->Text)>StrToFloat(m1->Lines->Strings[10]))
{
        suanzhi->Font->Color=clRed;
        Lsuan->Font->Color=clRed;
        Lsuan->Caption=FloatToStr(StrToFloat(suanzhi->Text)-StrToFloat(m1->Lines->Strings[10]));
}
else
{
suanzhi->Font->Color=clGreen;
Lsuan->Font->Color=clGreen;
Lsuan->Caption="OK";
}
if(StrToFloat(shandian->Text)>StrToFloat(m1->Lines->Strings[11]))
{
        shandian->Font->Color=clRed;
        Lshan->Font->Color=clRed;
        Lshan->Caption=FloatToStr(StrToFloat(shandian->Text)-StrToFloat(m1->Lines->Strings[11]));
}
else
{
shandian->Font->Color=clGreen;
Lshan->Font->Color=clGreen;
Lshan->Caption="OK";
}
if(StrToFloat(bizhong->Text)>StrToFloat(m1->Lines->Strings[12]))
{
      bizhong->Font->Color=clRed;
        Lbizhong->Font->Color=clRed;
        Lbizhong->Caption=FloatToStr(StrToFloat(bizhong->Text)-StrToFloat(m1->Lines->Strings[12]));
}
else
{
bizhong->Font->Color=clGreen;
Lbizhong->Font->Color=clGreen;
Lbizhong->Caption="OK";
}
if(StrToFloat(shuifen->Text)>StrToFloat(m1->Lines->Strings[13]))
{
        shuifen->Font->Color=clRed;
        Lshui->Font->Color=clRed;
        Lshui->Caption=FloatToStr(StrToFloat(shuifen->Text)-StrToFloat(m1->Lines->Strings[13]));
}
else
{
shuifen->Font->Color=clGreen;
Lshui->Font->Color=clGreen;
Lshui->Caption="OK";
}
if(StrToFloat(wurandu->Text)>StrToFloat(m1->Lines->Strings[14]))
{
        wurandu->Font->Color=clRed;
        Lwu->Font->Color=clRed;
        Lwu->Caption=FloatToStr(StrToFloat(wurandu->Text)-StrToFloat(m1->Lines->Strings[14]));
}
else
{
wurandu->Font->Color=clGreen;
Lwu->Font->Color=clGreen;
Lwu->Caption="OK";
}

}
__finally
{
delete m1;
}        //TODO: Add your source code here
}



void __fastcall TForm25::DBNavigator1Click(TObject *Sender,
      TNavigateBtn Button)
{
if(DataModule1->oilds->State==dsInsert)
{
  niandu->Text="0.0";
  suanzhi->Text="0.0";
  shandian->Text="0.0";
  wurandu->Text="0.0";
  shuifen->Text="0.0";
  bizhong->Text="0.0";
  fe->Text="0.0";
  cu->Text="0.0";
  ti->Text="0.0";
  ag->Text="0.0";
  mg->Text="0.0";
  cr->Text="0.0";
  si->Text="0.0";
  ni->Text="0.0";
  al->Text="0.0";
}
if(leixing->Text!=""&&jihao->Text!=""&&jixing->Text!=""&&sn->Text!=""
        &&fe->Text!=""&&ag->Text!=""&&al->Text!=""&&cr->Text!=""&&ni->Text!=""
        &&si->Text!=""&&cu->Text!=""&&ti->Text!=""&&mg->Text!=""&&niandu->Text!=""
        &&suanzhi->Text!=""&&shandian->Text!=""&&shuifen->Text!=""&&wurandu->Text!=""
        &&bizhong->Text!="")
        overstand();
        else
        ShowMessage("任何字段不能为空,空值字段请添入“0”"); 
}
//---------------------------------------------------------------------------

void __fastcall TForm25::FormClose(TObject *Sender, TCloseAction &Action)
{
DataModule1->oil->SaveToFile(DataModule1->oil->FileName,dfBinary);        
}
//---------------------------------------------------------------------------

void __fastcall TForm25::feChange(TObject *Sender)
{
 if(leixing->Text!=""&&jihao->Text!=""&&jixing->Text!=""&&sn->Text!=""
        &&fe->Text!=""&&ag->Text!=""&&al->Text!=""&&cr->Text!=""&&ni->Text!=""
        &&si->Text!=""&&cu->Text!=""&&ti->Text!=""&&mg->Text!=""&&niandu->Text!=""
        &&suanzhi->Text!=""&&shandian->Text!=""&&shuifen->Text!=""&&wurandu->Text!=""
        &&bizhong->Text!="")
        overstand();
}
//---------------------------------------------------------------------------


void __fastcall TForm25::Button1Click(TObject *Sender)
{
cxb=DataModule1->oil;
FBcxtj->Show();
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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