cptration_pict.cpp
来自「一个以前收集的基于C/S架构的ERP客户端源代码」· C++ 代码 · 共 155 行
CPP
155 行
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "CptRation_Pict.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "QueryBaseForm"
#pragma link "SDGrid"
#pragma link "KSAdvReport"
#pragma link "DateEdit"
#pragma resource "*.dfm"
TfrmCptRation_Pict *frmCptRation_Pict;
//---------------------------------------------------------------------------
__fastcall TfrmCptRation_Pict::TfrmCptRation_Pict(TComponent* Owner, HWND chWnd, AnsiString ClassCode,AnsiString WhereStr)
: TQueryBaseForm(Owner,chWnd,ClassCode,WhereStr)
{
FillGridWithData();
}
//--------------------------------------------------------------------------
//---------------------------------------------------------------------------
void __fastcall TfrmCptRation_Pict::ClearControl(bool BringToNext)
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmCptRation_Pict::GetDataFromComObject()
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmCptRation_Pict::WaitUserInput()
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmCptRation_Pict::RefreshGridData(int mAction)
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmCptRation_Pict::DisplayBill()
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmCptRation_Pict::GetBill(AnsiString BillID)
{
return;
}
//---------------------------------------------------------------------------
void __fastcall TfrmCptRation_Pict::FillGridWithData()
{
TComResultSet *RsQuery = new TComResultSet(Handle,g_ClientHandle);
AnsiString ItemStr,sSql,WcName;
float l_Qty,l_WcQty,l_Perc;
sSql=GetQueryStr();
Series1->Clear();
Series2->Clear();
Chart1->Title->Text->Text = "工作中心负荷图("+de_DateF->Text +")";
if(sSql=="")
return;
try
{
RsQuery->Open(sSql,"");
RsQuery->MoveFirst();
while( RsQuery->Eof == 0)
{
ItemStr=RsQuery->FieldByName("CptAnWcname") ;
//WcName = RsQuery->FieldByName("CptAnWcname") ;
l_Qty = StrToFloat(RsQuery->FieldByName("CptAnQty")) ;
l_WcQty= StrToFloat(RsQuery->FieldByName("CptAnWcQty")) ;
if (!CheckBox2->Checked)
{
Chart1->LeftAxis->Title->Caption="";
Chart1->LeftAxis->Maximum=800;
Series1->Add(l_Qty,ItemStr,clTeeColor);
Series2->Add(l_WcQty,ItemStr,clTeeColor);
}
else
{
l_Perc= l_Qty/l_WcQty*100;
Chart1->LeftAxis->Title->Caption="能力/负荷比(%)";
Chart1->LeftAxis->Maximum=200;
Series1->Add(l_Perc,ItemStr,clTeeColor);
}
RsQuery->MoveNext();
}
RsQuery->Close();
}
__finally
{
delete RsQuery;
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmCptRation_Pict::tbQueryClick(TObject *Sender)
{
try{
StartWaitForm("正在查询,请稍候...");
FillGridWithData();
}
__finally
{
EndWaitForm();
}
}
//---------------------------------------------------------------------------
//获取查询语句
AnsiString __fastcall TfrmCptRation_Pict::GetQueryStr()
{
AnsiString Selectstr,Fromstr,Wherestr,Orderstr;
Selectstr =" select * ";
Fromstr=" from ksVW_KsCptAnalyse ";
if(!(de_DateF->Text).IsEmpty())
Fromstr+=" where CptAnDate ='" +de_DateF->Text+"'";
Orderstr=" order by CptanWc ";
sSQL=Selectstr+Fromstr+Wherestr+Orderstr;
return(sSQL);
}
void __fastcall TfrmCptRation_Pict::tbRefreshClick(TObject *Sender)
{
if(sSQL=="")
return;
FillGridWithData();
}
//---------------------------------------------------------------------------
void __fastcall TfrmCptRation_Pict::Zoom(TChart *ch ,double present)
{
TRect r=ch->ChartRect;
r.Left=r.Left+present;
r.Right=r.Right-present;
r.Top=r.Top+present;
ch->ZoomRect(r);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?