plnoption.cpp
来自「科思ERP部分源码及控件」· C++ 代码 · 共 226 行
CPP
226 行
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "PlnOption.h"
#include "BaseGlobeVars.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "SDComboBox"
#pragma link "SDEdit"
#pragma link "StdBaseForm"
#pragma resource "*.dfm"
TfrmPlnOption *frmPlnOption;
//---------------------------------------------------------------------------
__fastcall TfrmPlnOption::TfrmPlnOption(TComponent* Owner,HWND chWnd,AnsiString ClassCode,AnsiString Param)
: TStdBaseForm(Owner,chWnd,ClassCode,Param)
{
scType->Clear();
scType->AddItems("1-天","1");
scType->AddItems("2-周","2");
scType->AddItems("3-旬","3");
scType->AddItems("4-半月","4");
scType->AddItems("5-月","5");
scType->AddItems("6-季","6");
scType->AddItems("7-半年","7");
scType->AddItems("8-年","8");
GetParameter();
}
//---------------------------------------------------------------------------
void __fastcall TfrmPlnOption::GetParameter()
{
AnsiString strSQL,m_ParmCode;
ParamSet=new TComResultSet(Handle,g_ClientHandle);
strSQL="select PARAMETERCODE,PARAMETERVALUE from sdparameter where ";
strSQL=strSQL+" PARAMETERCODE ='11101' or ";
strSQL=strSQL+" PARAMETERCODE ='11102' or ";
strSQL=strSQL+" PARAMETERCODE ='11103' or ";
strSQL=strSQL+" PARAMETERCODE ='11104' or ";
strSQL=strSQL+" PARAMETERCODE ='11105' or ";
strSQL=strSQL+" PARAMETERCODE ='11106' or ";
strSQL=strSQL+" PARAMETERCODE ='11107' or ";
strSQL=strSQL+" PARAMETERCODE ='11108' or ";
strSQL=strSQL+" PARAMETERCODE ='11109' or ";
strSQL=strSQL+" PARAMETERCODE ='11109' or ";
strSQL=strSQL+" PARAMETERCODE ='11110' or ";
strSQL=strSQL+" PARAMETERCODE ='11111' ";
ParamSet->Close();
ParamSet->Open(strSQL,"");
ParamSet->MoveFirst();
while(ParamSet->Eof==0)
{
m_ParmCode=ParamSet->FieldByName("PARAMETERCODE");
switch(m_ParmCode.ToInt())
{
case 11101:
sePeriod->Text=ParamSet->FieldByName("PARAMETERVALUE");
break;
case 11102:
seExeZq->Text=ParamSet->FieldByName("PARAMETERVALUE");
break;
case 11103:
sePlanZq->Text=ParamSet->FieldByName("PARAMETERVALUE");
break;
case 11104:
seNeedZq->Text=ParamSet->FieldByName("PARAMETERVALUE");
break;
case 11105:
seExeRow->Text=ParamSet->FieldByName("PARAMETERVALUE");
break;
case 11106:
seExeZqp->Text=ParamSet->FieldByName("PARAMETERVALUE");
break;
case 11107:
sePlanRow->Text=ParamSet->FieldByName("PARAMETERVALUE");
break;
case 11108:
sePlanZqp->Text=ParamSet->FieldByName("PARAMETERVALUE");
break;
case 11109:
seNeedRow->Text=ParamSet->FieldByName("PARAMETERVALUE");
break;
case 11110:
seNeedZqp->Text=ParamSet->FieldByName("PARAMETERVALUE");
break;
case 11111:
scType->LocateKey(ParamSet->FieldByName("PARAMETERVALUE"));
scType->Text=scType->ItemData[0];
break;
default :
break;
}
ParamSet->MoveNext();
}
ParamSet->Close();
}
//---------------------------------------------------------------------------
void __fastcall TfrmPlnOption::seExeZqChange(TObject *Sender)
{
int m_tempval;
AnsiString l_Text;
l_Text=seExeRow->Text;
if (l_Text==0)
l_Text=1;
m_tempval=StrToIntDef(seExeZq->Text,0);
m_tempval=m_tempval/StrToIntDef(l_Text,1);;
seExeZqp->Text=AnsiString(m_tempval);
}
//---------------------------------------------------------------------------
void __fastcall TfrmPlnOption::seExeRowChange(TObject *Sender)
{
int m_tempval;
AnsiString l_Text;
l_Text=seExeRow->Text;
if (l_Text==0)
l_Text=1;
m_tempval=StrToIntDef(seExeZq->Text,0);
m_tempval=m_tempval/StrToIntDef(l_Text,1);;
seExeZqp->Text=AnsiString(m_tempval);
}
//---------------------------------------------------------------------------
void __fastcall TfrmPlnOption::sePlanZqChange(TObject *Sender)
{
int m_tempval;
AnsiString l_Text;
l_Text=sePlanRow->Text;
if (l_Text==0)
l_Text=1;
m_tempval=StrToIntDef(sePlanZq->Text,0);
m_tempval=m_tempval/StrToIntDef(l_Text,1);;
sePlanZqp->Text=AnsiString(m_tempval);
}
//---------------------------------------------------------------------------
void __fastcall TfrmPlnOption::sePlanRowChange(TObject *Sender)
{
int m_tempval;
AnsiString l_Text;
l_Text=sePlanRow->Text;
if (l_Text==0)
l_Text=1;
m_tempval=StrToIntDef(sePlanZq->Text,0);
m_tempval=m_tempval/StrToIntDef(l_Text,1);;
sePlanZqp->Text=AnsiString(m_tempval);
}
//---------------------------------------------------------------------------
void __fastcall TfrmPlnOption::seNeedZqChange(TObject *Sender)
{
int m_tempval;
AnsiString l_Text;
l_Text=seNeedRow->Text;
if (l_Text==0)
l_Text=1;
m_tempval=StrToIntDef(seNeedZq->Text,0);
m_tempval=m_tempval/StrToIntDef(l_Text,1);;
seNeedZqp->Text=AnsiString(m_tempval);
}
//---------------------------------------------------------------------------
void __fastcall TfrmPlnOption::seNeedRowChange(TObject *Sender)
{
int m_tempval;
AnsiString l_Text;
l_Text=seNeedRow->Text;
if (l_Text==0)
l_Text=1;
m_tempval=StrToIntDef(seNeedZq->Text,0);
m_tempval=m_tempval/StrToIntDef(l_Text,1);;
seNeedZqp->Text=AnsiString(m_tempval);
}
//---------------------------------------------------------------------------
void __fastcall TfrmPlnOption::bbOkClick(TObject *Sender)
{
int m_tempVal=0;
if(scType->Text!="1-天"&&scType->Text!="2-周"&&scType->Text!="3-旬"&&scType->Text!="4-半月"&&scType->Text!="5-月"&&scType->Text!="6-季"&&scType->Text!="7-半年"&&scType->Text!="8-年")
throw Exception("周期类型只能为 :'1-天',2-周' ,'3-旬', '4-半月','5-月','6-季','7-半年','8-年'");
if(((seExeRow->Text.ToInt())*(seExeZqp->Text.ToInt()))!=seExeZq->Text.ToInt())
throw Exception("执行区参数设置错误!");
if((sePlanRow->Text.ToInt()*sePlanZqp->Text.ToInt())!=sePlanZq->Text.ToInt())
throw Exception("计划区参数设置错误!");
if((seNeedRow->Text.ToInt()*seNeedZqp->Text.ToInt())!=seNeedZq->Text.ToInt())
throw Exception("需求区参数设置错误!");
m_tempVal=m_tempVal+seExeZq->Text.ToInt();
m_tempVal=m_tempVal+sePlanZq->Text.ToInt();
m_tempVal=m_tempVal+seNeedZq->Text.ToInt();
if(sePeriod->Text!=AnsiString(m_tempVal))
::MessageBox(Handle,"展望期不等于周期数!请重新设置","操作错误",MB_OK|MB_ICONSTOP);
else
{
ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+sePeriod->Text+"' where PARAMETERCODE ='11101'"));
ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+seExeZq->Text+"' where PARAMETERCODE ='11102'"));
ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+sePlanZq->Text+"' where PARAMETERCODE ='11103'"));
ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+seNeedZq->Text+"' where PARAMETERCODE ='11104'"));
ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+seExeRow->Text+"' where PARAMETERCODE ='11105'"));
ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+seExeZqp->Text+"' where PARAMETERCODE ='11106'"));
ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+sePlanRow->Text+"' where PARAMETERCODE ='11107'"));
ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+sePlanZqp->Text+"' where PARAMETERCODE ='11108'"));
ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+seNeedRow->Text+"' where PARAMETERCODE ='11109'"));
ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+seNeedZqp->Text+"' where PARAMETERCODE ='11110'"));
ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+scType->ItemData[1]+"' where PARAMETERCODE ='11111'"));
Close();
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmPlnOption::bbCancelClick(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TfrmPlnOption::FormClose(TObject *Sender,
TCloseAction &Action)
{
TStdBaseForm::FormClose(Sender,Action);
delete ParamSet;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?