📄 pmdoc.cpp
字号:
if(m_BuyerCode.IsEmpty()==true)
throw Exception("当前没有记录可以删除!");
m_StoredProc->Close();
m_StoredProc->ProcedureName="sdBuyer_Delete";
m_StoredProc->Parameters->Clear();
m_StoredProc->Parameters->CreateParameter("@W_BuyerCode",ftString,pdInput,18,b_BuyerCode);
m_StoredProc->ExecProc();
DeleteRecord(this->b_BuyerCode);
}
void TsdBuyer::BackupValue()
{
b_BuyerCode = m_BuyerCode;
b_BuyerName = m_BuyerName;
b_BuyerTel = m_BuyerTel;
b_BuyerBeepPager = m_BuyerBeepPager;
b_BuyerCheck = m_BuyerCheck;
b_BuyerStop = m_BuyerStop;
b_BuyerCancel = m_BuyerCancel;
b_BuyerClose = m_BuyerClose;
b_BuyerPost = m_BuyerPost;
}
void TsdBuyer::RestoreValue()
{
m_BuyerCode = b_BuyerCode;
m_BuyerName = b_BuyerName;
m_BuyerTel = b_BuyerTel;
m_BuyerBeepPager = b_BuyerBeepPager;
m_BuyerCheck = b_BuyerCheck;
m_BuyerStop = b_BuyerStop;
m_BuyerCancel = b_BuyerCancel;
m_BuyerClose = b_BuyerClose;
m_BuyerPost = b_BuyerPost;
}
void TsdBuyer::EmptyValue(int Index)
{
switch(Index)
{
case 0:
m_BuyerCode = "";
m_BuyerName = "";
m_BuyerTel = "";
m_BuyerBeepPager = "";
m_BuyerCheck = 0;
m_BuyerStop = 0;
m_BuyerCancel = 0;
m_BuyerClose = 0;
m_BuyerPost = 0;
break;
case 1:
b_BuyerCode = "";
b_BuyerName = "";
b_BuyerTel = "";
b_BuyerBeepPager = "";
b_BuyerCheck = 0;
b_BuyerStop = 0;
b_BuyerCancel = 0;
b_BuyerClose = 0;
b_BuyerPost = 0;
break;
}
}
void TsdBuyer::BatchLetValue()
{
m_BuyerCode = m_Query->FieldValues["BuyerCode"];
m_BuyerTel = m_Query->FieldValues["BuyerTel"];
m_BuyerName = m_Query->FieldValues["BuyerName"];
m_BuyerBeepPager = m_Query->FieldValues["BuyerBeepPager"];
m_BuyerCheck = m_Query->FieldValues["BuyerCheck"];
m_BuyerStop = m_Query->FieldValues["BuyerStop"];
m_BuyerCancel = m_Query->FieldValues["BuyerCancel"];
m_BuyerClose = m_Query->FieldValues["BuyerClose"];
m_BuyerPost = m_Query->FieldValues["BuyerPost"];
BackupValue();
}
void TsdBuyer::Assign(TsdBuyer *p)
{
this->SetActionID(p->CurStatus);
this->m_BuyerCode=p->m_BuyerCode;
this->m_BuyerName=p->m_BuyerName;
this->m_BuyerTel=p->m_BuyerTel;
this->m_BuyerBeepPager=p->m_BuyerBeepPager;
this->m_BuyerCheck=p->m_BuyerCheck;
this->m_BuyerStop=p->m_BuyerStop;
this->m_BuyerCancel=p->m_BuyerCancel;
this->m_BuyerClose=p->m_BuyerClose;
this->m_BuyerPost=p->m_BuyerPost;
this->BackupValue();
}
void TsdBuyer::AssignValue()
{
TsdBuyer *p=(TsdBuyer *)Records(CurRecNo);
this->SetActionID(p->CurStatus);
this->m_BuyerCode=p->m_BuyerCode;
this->m_BuyerName=p->m_BuyerName;
this->m_BuyerTel=p->m_BuyerTel;
this->m_BuyerBeepPager=p->m_BuyerBeepPager;
this->m_BuyerCheck=p->m_BuyerCheck;
this->m_BuyerStop=p->m_BuyerStop;
this->m_BuyerCancel=p->m_BuyerCancel;
this->m_BuyerClose=p->m_BuyerClose;
this->m_BuyerPost=p->m_BuyerPost;
this->BackupValue();
}
int TsdBuyer::Query()
{
AnsiString m_SqlStr;
m_SqlStr=QueryString;
if(FilterString.IsEmpty()==false)
m_SqlStr=m_SqlStr+" where "+FilterString;
if(OrderString.IsEmpty()==false)
m_SqlStr=m_SqlStr+" Order by "+OrderString;
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add(m_SqlStr);
m_Query->Open();
ClearRecord();
if(m_Query->RecordCount>0)
{
m_Query->First();
while(!m_Query->Eof)
{
BatchLetValue();
TsdBuyer *p=new TsdBuyer( );
SetActionID(1);
p->Assign(this);
AddRecord((void *)p,p->BuyerCode);
m_Query->Next();
}
MoveFirst();
}
m_Query->Close();
return Count;
}
bool TsdBuyer::Find(AnsiString WhereStr)
{
AnsiString m_SqlStr;
if(WhereStr.IsEmpty()==true)
throw Exception("查找表达式不能为空");
m_SqlStr="SELECT * FROM SDBuyer WHERE "+WhereStr;
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add(m_SqlStr);
m_Query->Open();
if(m_Query->RecordCount!=1)
{
m_Query->Close();
return false;
}
else
{
BatchLetValue();
m_Query->Close();
return true;
}
}
TsdBuyer::~TsdBuyer()
{
try{
}
catch(...)
{
throw Exception("析构函数出错");
}
}
//====================================================================
// (TsdSupply)供应商资料
//===================================================================
void __fastcall TsdSupply::SetSupplyCode(AnsiString value)
{
if (value.IsEmpty() )
throw Exception("供应商编码不能为空!");
if(value.Length()>18)
throw Exception("供应商代码长度不能大于18");
if (value.UpperCase()!=m_SupplyCode.UpperCase())
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("SELECT SUPPLYCODE FROM SDSUPPLY WHERE SUPPLYCODE='" +value+"'");
m_Query->Open();
if(m_Query->RecordCount>0)
{
m_Query->Close();
throw Exception("供应商编码'"+value+"'已定义");
}
m_Query->Close();
}
m_SupplyCode = value;
}
void __fastcall TsdSupply::SetSupplyName(AnsiString value)
{
if(value.IsEmpty())
throw Exception("供应商名称不能为空");
if(value.Length()>40)
throw Exception("供应商名称长度不能大于40");
if (value!=m_SupplyName)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("SELECT SUPPLYCODE FROM SDSUPPLY WHERE SUPPLYName='" +value+"'");
m_Query->Open();
if(m_Query->RecordCount>0)
{
m_Query->Close();
throw Exception("供应商名称'"+value+"'已定义");
}
m_Query->Close();
}
m_SupplyName = value;
}
void __fastcall TsdSupply::SetSupplyDesc(AnsiString value)
{
if(value.Length()>40)
throw Exception("备注长度不能大于40");
m_SupplyDesc = value;
}
void __fastcall TsdSupply::SetSupplyType(AnsiString value)
{
if(value.IsEmpty())
throw Exception("供应商类型代码不能为空");
if(value.Length()>18)
throw Exception("供应商类型代码长度不能大于18");
if (value!=m_SupplyType)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("SELECT PtypeCode FROM SDPtype WHERE PtypeCode='" +value+"'");
m_Query->Open();
if(m_Query->RecordCount<=0)
{
m_Query->Close();
throw Exception("供应商类型'"+value+"'未定义");
}
m_Query->Close();
}
m_SupplyType = value;
}
void __fastcall TsdSupply::SetSupplyLegalman(AnsiString value)
{
if(value.Length()>10)
throw Exception("法人名称长度不能大于10");
m_SupplyLegalman = value;
}
void __fastcall TsdSupply::SetSupplyLinkman(AnsiString value)
{
if(value.Length()>20)
throw Exception("联系人名称长度不能大于20");
m_SupplyLinkman = value;
}
void __fastcall TsdSupply::SetSupplyAddr(AnsiString value)
{
if(value.Length()>40)
throw Exception("地址长度不能大于40");
m_SupplyAddr = value;
}
void __fastcall TsdSupply::SetSupplyZip(AnsiString value)
{
if(value.Length()>6)
throw Exception("邮编长度不能大于6");
m_SupplyZip = value;
}
void __fastcall TsdSupply::SetSupplyTel(AnsiString value)
{
if(value.Length()>20)
throw Exception("电话长度不能大于20");
m_SupplyTel = value;
}
void __fastcall TsdSupply::SetSupplyFax(AnsiString value)
{
if(value.Length()>20)
throw Exception("传真长度不能大于20");
m_SupplyFax = value;
}
void __fastcall TsdSupply::SetSupplyEmail(AnsiString value)
{
if(value.Length()>20)
throw Exception("E-MAIL长度不能大于20");
m_SupplyEmail = value;
}
void __fastcall TsdSupply::SetSupplyCredit(AnsiString value)
{
if(value.Length()>18)
throw Exception("信誉代码长度不能大于18");
if(value.IsEmpty()==false&&value!=m_SupplyCredit)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("SELECT CreditCode FROM SDCredit WHERE CreditCODE='" +value+"'");
m_Query->Open();
if(m_Query->RecordCount<=0)
{
m_Query->Close();
throw Exception("信誉编码'"+value+"'未定义");
}
m_Query->Close();
}
m_SupplyCredit = value;
}
void __fastcall TsdSupply::SetSupplyCancel(int value)
{
if(value!=0&&value!=1)
throw Exception("取消标志只能取值0-正常1-取消");
m_SupplyCancel = value;
}
void __fastcall TsdSupply::SetSupplyTaxCode(AnsiString value)
{
if(value.Length()>18)
throw Exception("税码长度不能大于18");
if(value.IsEmpty()==false&&value!=m_SupplyTaxCode)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("SELECT TaxCODE FROM SDTax WHERE TaxCODE='" +value+"'");
m_Query->Open();
if(m_Query->RecordCount<=0)
{
m_Query->Close();
throw Exception("税码'"+value+"'未定义");
}
m_Query->Close();
}
m_SupplyTaxCode = value;
}
void __fastcall TsdSupply::SetSupplyTaxNo(AnsiString value)
{
if(value.Length()>18)
throw Exception("税号长度不能大于18");
m_SupplyTaxNo = value;
}
void __fastcall TsdSupply::SetSupplyArea(AnsiString value)
{
if(value.IsEmpty())
throw Exception("地区代码不能为空");
if(value.Length()>18)
throw Exception("地区代码长度不能大于18");
if (value!=m_SupplyArea)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("SELECT AreaCODE FROM SDArea WHERE AreaCODE='" +value+"'");
m_Query->Open();
if(m_Query->RecordCount<=0)
{
m_Query->Close();
throw Exception("地区编码'"+value+"'未定义");
}
m_Query->Close();
}
m_SupplyArea = value;
}
void __fastcall TsdSupply::SetSupplyTrade(AnsiString value)
{
if(value.IsEmpty())
throw Exception("行业代码不能为空");
if(value.Length()>18)
throw Exception("行业代码长度不能大于18");
if (value!=m_SupplyTrade)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("SELECT TradeCODE FROM SDTrade WHERE TradeCODE='" +value+"'");
m_Query->Open();
if(m_Query->RecordCount<=0)
{
m_Query->Close();
throw Exception("行业编码'"+value+"'未定义");
}
m_Query->Close();
}
m_SupplyTrade = value;
}
void __fastcall TsdSupply::SetSupplyPmode(AnsiString value)
{
if(value.Length()>18)
throw Exception("采购方式长度不能大于18");
if(value.IsEmpty()==false && value!=m_SupplyPmode)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("SELECT PmodeCODE FROM SDPmode WHERE PmodeCODE='" +value+"'");
m_Query->Open();
if(m_Query->RecordCount<=0)
{
m_Query->Close();
throw Exception("采购方式编码'"+value+"'未定义");
}
m_Query->Close();
}
m_SupplyPmode = value;
}
void __fastcall TsdSupply::SetSupplyBuyer(AnsiString value)
{
if(value.IsEmpty())
throw Exception("采购员编码不能为空");
if(value.Length()>18)
throw Exception("采购员编码长度不能大于18");
if (value!=m_SupplyBuyer)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("SELECT BuyerCODE FROM SDBuyer WHERE BuyerCODE='" +value+"'");
m_Query->Open();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -