📄 imhdl.cpp
字号:
m_StoredProc->Parameters->CreateParameter("@AlfdDSo",ftString,pdInput,18,m_AlfdDSo);
m_StoredProc->Parameters->CreateParameter("@AlfdDSodLine",ftInteger,pdInput,10,m_AlfdDSodLine);
m_StoredProc->Parameters->CreateParameter("@AlfdDesc",ftString,pdInput,40,m_AlfdDesc);
m_StoredProc->ExecProc();
}
else
{
m_StoredProc->ProcedureName="sdAlfd_Update";
m_StoredProc->Parameters->Clear();
m_StoredProc->Parameters->CreateParameter("@W_AlfdCode",ftString,pdInput,18,b_AlfdCode);
m_StoredProc->Parameters->CreateParameter("@W_AlfdLine",ftInteger,pdInput,18,b_AlfdLine);
m_StoredProc->Parameters->CreateParameter("@AlfdLine",ftInteger,pdInput,10,m_AlfdLine);
m_StoredProc->Parameters->CreateParameter("@AlfdGoods",ftString,pdInput,18,m_AlfdGoods);
m_StoredProc->Parameters->CreateParameter("@AlfdUnit",ftString,pdInput,18,m_AlfdUnit);
m_StoredProc->Parameters->CreateParameter("@AlfdConv",ftFloat,pdInput,12,m_AlfdConv);
m_StoredProc->Parameters->CreateParameter("@AlfdQty",ftFloat,pdInput,12,m_AlfdQty);
m_StoredProc->Parameters->CreateParameter("@AlfdSBatch",ftString,pdInput,18,m_AlfdSBatch);
m_StoredProc->Parameters->CreateParameter("@AlfdSSo",ftString,pdInput,18,m_AlfdSSo);
m_StoredProc->Parameters->CreateParameter("@AlfdSSodLine",ftInteger,pdInput,10,m_AlfdSSodLine);
m_StoredProc->Parameters->CreateParameter("@AlfdDBatch",ftString,pdInput,18,m_AlfdDBatch);
m_StoredProc->Parameters->CreateParameter("@AlfdDSo",ftString,pdInput,18,m_AlfdDSo);
m_StoredProc->Parameters->CreateParameter("@AlfdDSodLine",ftInteger,pdInput,10,m_AlfdDSodLine);
m_StoredProc->Parameters->CreateParameter("@AlfdDesc",ftString,pdInput,40,m_AlfdDesc);
m_StoredProc->ExecProc();
}
TsdAlfd *p = new TsdAlfd();
SetActionID(1);
p->Assign(this);
ChangeRecord((void *)p,p->AlfdLine,this->AlfdLine);
}
//---------------------------------------------------------------------------
void TsdAlfd::Delete()
{
if(CurStatus!=1)
throw Exception("当前状态不能进行删除操作!");
if(m_AlfdLine == 0)
throw Exception("当前没有记录可以删除!");
m_StoredProc->Close();
m_StoredProc->ProcedureName="sdAlfd_Delete";
m_StoredProc->Parameters->Clear();
m_StoredProc->Parameters->CreateParameter("@W_AlfdCode",ftString,pdInput,18,b_AlfdCode);
m_StoredProc->Parameters->CreateParameter("@W_AlfdLine",ftString,pdInput,18,b_AlfdLine);
m_StoredProc->ExecProc();
DeleteRecord(this->b_AlfdLine);
}
//---------------------------------------------------------------------------
void TsdAlfd::Assign(TsdAlfd *p)
{
this->SetActionID(p->CurStatus);
this->m_AlfdCode =p->m_AlfdCode ;
this->m_AlfdGoods =p->m_AlfdGoods ;
this->m_AlfdOLoc =p->m_AlfdOLoc;
this->m_AlfdILoc =p->m_AlfdILoc;
this->m_AlfdLine =p->m_AlfdLine ;
this->m_AlfdUnit =p->m_AlfdUnit ;
this->m_AlfdConv =p->m_AlfdConv;
this->m_AlfdQty =p->m_AlfdQty ;
this->m_AlfdSBatch =p->m_AlfdSBatch ;
this->m_AlfdSSo =p->m_AlfdSSo ;
this->m_AlfdSSodLine =p->m_AlfdSSodLine ;
this->m_AlfdDBatch =p->m_AlfdDBatch ;
this->m_AlfdDSo =p->m_AlfdDSo ;
this->m_AlfdDSodLine =p->m_AlfdDSodLine ;
this->m_AlfdDesc =p->m_AlfdDesc ;
if(this->CurStatus==3)
{
this->b_AlfdCode =p->b_AlfdCode ;
this->b_AlfdGoods =p->b_AlfdGoods ;
this->b_AlfdOLoc =p->b_AlfdOLoc;
this->b_AlfdILoc =p->b_AlfdILoc;
this->b_AlfdLine =p->b_AlfdLine ;
this->b_AlfdUnit =p->b_AlfdUnit ;
this->b_AlfdConv =p->b_AlfdConv;
this->b_AlfdQty =p->b_AlfdQty ;
this->b_AlfdSBatch =p->b_AlfdSBatch ;
this->b_AlfdSSo =p->b_AlfdSSo ;
this->b_AlfdSSodLine =p->b_AlfdSSodLine ;
this->b_AlfdDBatch =p->b_AlfdDBatch ;
this->b_AlfdDSo =p->b_AlfdDSo ;
this->b_AlfdDSodLine =p->b_AlfdDSodLine ;
this->b_AlfdDesc =p->b_AlfdDesc ;
}
else
this->BackupValue();
}
//---------------------------------------------------------------------------
void TsdAlfd::AssignValue()
{
TsdAlfd *p=(TsdAlfd *)Records(CurRecNo);
Assign(p);
}
//---------------------------------------------------------------------------
int TsdAlfd::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();
TsdAlfd *p=new TsdAlfd();
SetActionID(1);
p->Assign(this);
AddRecord((void *)p,p->AlfdLine);
m_Query->Next();
}
MoveFirst();
}
m_Query->Close();
return Count;
}
//---------------------------------------------------------------------------
bool TsdAlfd::Find(AnsiString WhereStr)
{
AnsiString m_SqlStr;
if(WhereStr.IsEmpty()==true)
throw Exception("查找表达式不能为空");
m_SqlStr="select * from sdAlfd 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;
}
}
//**************************************
// (TsdTsh)盘点单单头
//**************************************
void __fastcall TsdTsh::SetTshCode(AnsiString value)
{
if(value.IsEmpty())
throw Exception("盘点单单头编码不能为空!");
if(value.Length()>18)
throw Exception("盘点单号长度不能大于18");
if(value.UpperCase() != m_TshCode.UpperCase())
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("SELECT TshCODE FROM SDTsh WHERE TshCODE='" +value+"'");
m_Query->Open();
if(m_Query->RecordCount>0)
{
m_Query->Close();
throw Exception("盘点单单头编码'"+value+"'已存在");
}
m_Query->Close();
}
m_TshCode = value;
}
void __fastcall TsdTsh::SetTshDate(AnsiString value)
{
if(value.IsEmpty())
throw Exception("盘点日期不能为空");
m_TshDate=Validate(value);
}
void __fastcall TsdTsh::SetTshDept(AnsiString value)
{
if(value.IsEmpty())
throw Exception("部门编码不能为空");
if(value.Length()>18)
throw Exception("部门编码长度不能大于18");
if(value!=m_TshDept)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("select deptcode from sddept where deptcode='"+value+"'");
m_Query->Open();
if(m_Query->RecordCount<=0)
{
m_Query->Close();
throw Exception("部门编码:"+value+"未定义");
}
m_Query->Close();
}
m_TshDept=value;
}
void __fastcall TsdTsh::SetTshPosType(AnsiString value)
{
if(value.IsEmpty())
throw Exception("收发存项目编码不能为空");
if(value.Length()>18)
throw Exception("项目编码长度不能大于18");
if(value!=m_TshPosType)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("select postypecode from sdpostype where postypecode='"+value+"'");
m_Query->Open();
if(m_Query->RecordCount<=0)
{
m_Query->Close();
throw Exception("收发存项目编码:"+value+"未定义");
}
m_Query->Close();
}
m_TshPosType=value;
}
void __fastcall TsdTsh::SetTshEiDate(AnsiString value)
{
if(value.IsEmpty()==false)
m_TshEiDate=Validate(value);
else
m_TshEiDate="";
}
void __fastcall TsdTsh::SetTshEoDate(AnsiString value)
{
if(value.IsEmpty()==false)
m_TshEoDate=Validate(value);
else
m_TshEoDate="";
}
void __fastcall TsdTsh::SetTshCDate(AnsiString value)
{
if(value.IsEmpty())
throw Exception("完成日期不能为空");
m_TshCDate=Validate(value);
}
void __fastcall TsdTsh::SetTshDesc(AnsiString value)
{
if(value.Length()>40)
throw Exception("备注长度不能大于40");
m_TshDesc=value;
}
void __fastcall TsdTsh::SetTshCheck(int value)
{
if(value!=0 && value!=1)
throw Exception("审核标志只能取值0-未审,1-已审");
m_TshCheck=value;
}
void __fastcall TsdTsh::SetTshChecker(AnsiString value)
{
if(m_TshCheck==1)
{
if(value.IsEmpty())
throw Exception("审核员代码不能为空");
if(value.Length()>18)
throw Exception("审核员代码长度不能大于18");
if(value!=m_TshChecker)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("select keepercode from sdkeeper where keepercode='"+value+"' and Keepercheck=1");
m_Query->Open();
if(m_Query->RecordCount<=0)
{
m_Query->Close();
throw Exception("审核员代码未定义或没有审核权限");
}
m_Query->Close();
}
m_TshChecker=value;
}
else
m_TshChecker="";
}
void __fastcall TsdTsh::SetTshCheckDate(AnsiString value)
{
if(m_TshCheck==1)
{
if(value.IsEmpty())
throw Exception("审核日期不能为空");
m_TshCheckDate=Validate(value);
}
else
m_TshCheckDate="";
}
void __fastcall TsdTsh::SetTshFmonth(AnsiString value)
{
AnsiString s;
if(value.IsEmpty())
throw Exception("财务月份不能为空");
/*
if(value!=m_TshFmonth)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("select fcmonth from sdfc where fcmonth='"+value+"'");
m_Query->Open();
if(m_Query->RecordCount<=0)
{
m_Query->Close();
throw Exception("财务月份:"+value+"未定义");
}
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("select fcmonth from sdfc where fccurrent=1");
m_Query->Open();
if(m_Query->RecordCount<=0)
{
m_Query->Close();
throw Exception("未定义当前财务月份");
}
s=m_Query->FieldValues["FcMonth"];
if(value<s)
{
m_Query->Close();
throw Exception("财务月份不能小于当前月份");
}
m_Query->Close();
}
*/
m_TshFmonth=value;
}
void __fastcall TsdTsh::SetTshUser(AnsiString value)
{
if(value.IsEmpty())
throw Exception("操作员代码不能为空");
if(value.Length()>18)
throw Exception("操作员代码长度不能大于18");
if(value!=m_TshUser)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("select usercode from sduser where usercode='"+value+"'");
m_Query->Open();
if(m_Query->RecordCount<=0)
{
m_Query->Close();
throw Exception("操作员代码:"+value+"未定义");
}
m_Query->Close();
}
m_TshUser=value;
}
void __fastcall TsdTsh::SetTshKeeper(AnsiString value)
{
if(value.IsEmpty())
throw Exception("仓管员代码不能为空");
if(value.Length()>18)
throw Exception("仓管员代码长度不能大于18");
if(value!=m_TshKeeper)
{
m_Query->Close();
m_Query->SQL->Clear();
m_Query->SQL->Add("select Keepercode from sdKeeper where Keepercode='"+value+"'");
m_Query->Open();
if(m_Query->RecordCount<=0)
{
m_Query->Close();
throw Exception("仓管员代码:"+value+"未定义");
}
m_Query->Close();
}
m_TshKeeper=value;
}
void __fastcall TsdTsh::SetTshCancel(int value)
{
if(value!=0 && value!=1)
throw Exception("取消标志只能取值0-正常,1-取消");
m_TshCancel=value;
}
void __fastcall TsdTsh::SetTshCancelDate(AnsiString value)
{
if(m_TshCancel==1)
{
if(value.IsEmpty())
throw Exception("取消日期不能为空");
m_TshCancelDate=Validate(value);
}
else
m_TshCancelDate="";
}
void __fastcall TsdTsh::SetTshType(int value)
{
if(value!=1 && va
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -