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

📄 plnoption.cpp

📁 速达开源ERP系统
💻 CPP
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "PlnOption.h"
#include "sdappserver_tlb.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "SDComboBox"
#pragma link "SDEdit"
#pragma resource "*.dfm"
TfrmPlnOption *frmPlnOption;
//---------------------------------------------------------------------------
__fastcall TfrmPlnOption::TfrmPlnOption(TComponent* Owner)
  : TStdBaseForm(Owner)
{
    ParamSet=NewResultSet();
    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;
    strSQL="select PARAMETERCODE,PARAMETERVALUE  from sdparameter  where ";
    strSQL=strSQL+" PARAMETERCODE ='10901' or ";
    strSQL=strSQL+" PARAMETERCODE ='10902' or ";
    strSQL=strSQL+" PARAMETERCODE ='10903' or ";
    strSQL=strSQL+" PARAMETERCODE ='10904' or ";
    strSQL=strSQL+" PARAMETERCODE ='10905' or ";
    strSQL=strSQL+" PARAMETERCODE ='10906' or ";
    strSQL=strSQL+" PARAMETERCODE ='10907' or ";
    strSQL=strSQL+" PARAMETERCODE ='10908' or ";
    strSQL=strSQL+" PARAMETERCODE ='10909' or ";
    strSQL=strSQL+" PARAMETERCODE ='10909' or ";
    strSQL=strSQL+" PARAMETERCODE ='10910' or ";
    strSQL=strSQL+" PARAMETERCODE ='10911'  ";
    ParamSet->Close();
    ParamSet->Open(strSQL,"");
    ParamSet->MoveFirst();
    while(ParamSet->Eof==0)
    {
       m_ParmCode=ParamSet->FieldByName("PARAMETERCODE");
       switch(m_ParmCode.ToInt())
       {
         case 10901:
          sePeriod->Text=ParamSet->FieldByName("PARAMETERVALUE");
          break;
         case 10902:
          seExeZq->Text=ParamSet->FieldByName("PARAMETERVALUE");
          break;
         case 10903:
          sePlanZq->Text=ParamSet->FieldByName("PARAMETERVALUE");
          break;
         case 10904:
          seNeedZq->Text=ParamSet->FieldByName("PARAMETERVALUE");
          break;
         case 10905:
          seExeRow->Text=ParamSet->FieldByName("PARAMETERVALUE");
          break;
         case 10906:
          seExeZqp->Text=ParamSet->FieldByName("PARAMETERVALUE");
          break;
         case 10907:
          sePlanRow->Text=ParamSet->FieldByName("PARAMETERVALUE");
          break;
         case 10908:
          sePlanZqp->Text=ParamSet->FieldByName("PARAMETERVALUE");
          break;
         case 10909:
          seNeedRow->Text=ParamSet->FieldByName("PARAMETERVALUE");
          break;
         case 10910:
          seNeedZqp->Text=ParamSet->FieldByName("PARAMETERVALUE");
          break;
         case 10911:
           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;
   m_tempval=StrToIntDef(seExeZq->Text,0);
   m_tempval=m_tempval/StrToIntDef(seExeRow->Text,1);;
   seExeZqp->Text=AnsiString(m_tempval);
}
//---------------------------------------------------------------------------
void __fastcall TfrmPlnOption::seExeRowChange(TObject *Sender)
{
   int m_tempval;
   m_tempval=StrToIntDef(seExeZq->Text,0);
   m_tempval=m_tempval/StrToIntDef(seExeRow->Text,1);;
   seExeZqp->Text=AnsiString(m_tempval);

}
//---------------------------------------------------------------------------
void __fastcall TfrmPlnOption::sePlanZqChange(TObject *Sender)
{
   int m_tempval;
   m_tempval=StrToIntDef(sePlanZq->Text,0);
   m_tempval=m_tempval/StrToIntDef(sePlanRow->Text,1);;
   sePlanZqp->Text=AnsiString(m_tempval);
}
//---------------------------------------------------------------------------
void __fastcall TfrmPlnOption::sePlanRowChange(TObject *Sender)
{
   int m_tempval;
   m_tempval=StrToIntDef(sePlanZq->Text,0);
   m_tempval=m_tempval/StrToIntDef(sePlanRow->Text,1);;
   sePlanZqp->Text=AnsiString(m_tempval);
}
//---------------------------------------------------------------------------
void __fastcall TfrmPlnOption::seNeedZqChange(TObject *Sender)
{
   int m_tempval;
   m_tempval=StrToIntDef(seNeedZq->Text,0);
   m_tempval=m_tempval/StrToIntDef(seNeedRow->Text,1);;
   seNeedZqp->Text=AnsiString(m_tempval);
}
//---------------------------------------------------------------------------
void __fastcall TfrmPlnOption::seNeedRowChange(TObject *Sender)
{
   int m_tempval;
   m_tempval=StrToIntDef(seNeedZq->Text,0);
   m_tempval=m_tempval/StrToIntDef(seNeedRow->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 ='10901'"));
     ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+seExeZq->Text+"' where PARAMETERCODE ='10902'"));
     ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+sePlanZq->Text+"' where PARAMETERCODE ='10903'"));
     ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+seNeedZq->Text+"' where PARAMETERCODE ='10904'"));
     ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+seExeRow->Text+"' where PARAMETERCODE ='10905'"));
     ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+seExeZqp->Text+"' where PARAMETERCODE ='10906'"));
     ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+sePlanRow->Text+"' where PARAMETERCODE ='10907'"));
     ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+sePlanZqp->Text+"' where PARAMETERCODE ='10908'"));
     ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+seNeedRow->Text+"' where PARAMETERCODE ='10909'"));
     ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+seNeedZqp->Text+"' where PARAMETERCODE ='10910'"));
     ParamSet->Execute(WideString("update sdParameter set PARAMETERVALUE='"+scType->ItemData[1]+"' where PARAMETERCODE ='10911'"));
     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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -