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

📄 qmhdl.cpp

📁 邮 电 公 司 erp源码
💻 CPP
📖 第 1 页 / 共 3 页
字号:
            m_sdQcsd->Delete();
        }
    }
}
//---------------------------------------------------------------------------
void TsdQcsh::CancelItem()
{
    m_sdQcsd->Cancel();
}
//---------------------------------------------------------------------------
void TsdQcsh::AddToObject()
{
    TsdQcsd *p=new TsdQcsd();
    p->Assign(m_sdQcsd);
    if(m_sdQcsd->FindKey(m_sdQcsd->GetOldFieldValue(fiQcsdLine)))
        m_sdQcsd->ChangeRecord((void*)p,p->GetFieldValue(fiQcsdLine),m_sdQcsd->GetOldFieldValue(fiQcsdLine));
    else
        m_sdQcsd->AddRecord((void *)p,p->GetFieldValue(fiQcsdLine));
}
//---------------------------------------------------------------------------
bool TsdQcsh::LocateItemByIndex(int Index)
{
    return m_sdQcsd->LocateByIndex(Index);
}
//---------------------------------------------------------------------------
bool TsdQcsh::LocateItemByKey(AnsiString Key)
{
    return m_sdQcsd->LocateByKey(Key);
}
//---------------------------------------------------------------------------
void TsdQcsh::BackupValue()
{
     b_sdQcsd=m_sdQcsd;
     b_QcshCode=m_QcshCode;
     b_QcshDate=m_QcshDate;
     b_QcshType=m_QcshType;
     b_QcshDocCode=m_QcshDocCode;
     b_QcshUser=m_QcshUser;
     b_QcshCheck=m_QcshCheck;
     b_QcshChecker=m_QcshChecker;
     b_QcshCheckDate=m_QcshCheckDate;
     b_QcshSysDate=m_QcshSysDate;
}
//---------------------------------------------------------------------------
void TsdQcsh::RestoreItem()
{
  m_sdQcsd->RestoreValue();
}
//---------------------------------------------------------------------------
void TsdQcsh::RestoreValue()
{
    m_sdQcsd=b_sdQcsd;
    m_QcshCode=b_QcshCode;
    m_QcshDate=b_QcshDate;
    m_QcshType=b_QcshType;
    m_QcshDocCode=b_QcshDocCode;
    m_QcshUser=b_QcshUser;
    m_QcshCheck=b_QcshCheck;
    m_QcshChecker=b_QcshChecker;
    m_QcshCheckDate=b_QcshCheckDate;
    m_QcshSysDate=b_QcshSysDate;
}
//---------------------------------------------------------------------------
void TsdQcsh::EmptyValue(int Index)
{
   switch(Index)
   {
    case 0:
     m_QcshCode="";
     m_QcshDate="";
     m_QcshType=0;
     m_QcshDocCode="";
     m_QcshUser="";
     m_QcshCheck=0;
     m_QcshChecker="";
     m_QcshCheckDate="";
     m_QcshSysDate="";
    break;
    case 1:
    b_QcshCode="";
    b_QcshDate="";
    b_QcshType=0;
    b_QcshDocCode="";
    b_QcshUser="";
    b_QcshCheck=0;
    b_QcshChecker="";
    b_QcshCheckDate="";
    b_QcshSysDate="";
      break;
    }
}
//---------------------------------------------------------------------------
void TsdQcsh::BatchLetValue()
{
     m_QcshCode=m_Query->FieldValues["QcshCode"];
     m_QcshDate=m_Query->FieldValues["QcshDate"];
     m_QcshType=m_Query->FieldValues["QcshType"];
     m_QcshDocCode=m_Query->FieldValues["QcshDocCode"];
     m_QcshUser=m_Query->FieldValues["QcshUser"];
     m_QcshCheck=m_Query->FieldValues["QcshCheck"];
     m_QcshChecker=m_Query->FieldValues["QcshChecker"];
     m_QcshCheckDate=m_Query->FieldValues["QcshCheckDate"];
     m_QcshSysDate=m_Query->FieldValues["QcshSysDate"];
    BackupValue();
}
//---------------------------------------------------------------------------
void TsdQcsh::Assign(TsdQcsh *p)
{
     this->SetActionID(p->CurStatus);
     this->m_sdQcsd=p->m_sdQcsd;
     this->m_QcshCode=p->m_QcshCode;
     this->m_QcshDate=p->m_QcshDate;
     this->m_QcshType=p->m_QcshType;
     this->m_QcshDocCode=p->m_QcshDocCode;
     this->m_QcshUser=p->m_QcshUser;
     this->m_QcshCheck=p->m_QcshCheck;
     this->m_QcshChecker=p->m_QcshChecker;
     this->m_QcshCheckDate=p->m_QcshCheckDate;
     this->m_QcshSysDate=p->m_QcshSysDate;
   if(this->CurStatus==3)
     {
     this->b_sdQcsd=p->b_sdQcsd;
     this->b_QcshCode=p->b_QcshCode;
     this->b_QcshDate=p->b_QcshDate;
     this->b_QcshType=p->b_QcshType;
     this->b_QcshDocCode=p->b_QcshDocCode;
     this->b_QcshUser=p->b_QcshUser;
     this->b_QcshCheck=p->b_QcshCheck;
     this->b_QcshChecker=p->b_QcshChecker;
     this->b_QcshCheckDate=p->b_QcshCheckDate;
     this->b_QcshSysDate=p->b_QcshSysDate;
     }
  else
    this->BackupValue();
}
//---------------------------------------------------------------------------
void TsdQcsh::AssignValue()
{
    TsdQcsh *p=(TsdQcsh *)Records(CurRecNo);
    Assign(p);
}
//---------------------------------------------------------------------------
int TsdQcsh::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();
    for(int i=0;i<this->Count;i++)
     {
        this->LocateByIndex(i);
        this->AssignValue();
        delete m_sdQcsd;
      }

    ClearRecord();
    if(m_Query->RecordCount>0)
    {
        m_Query->First();
        while(!m_Query->Eof)
        {
            BatchLetValue();
            NewDetail();
            m_sdQcsd->FilterString="QcsdCode='"+m_QcshCode+"'";
            m_sdQcsd->OrderString="QcsdLine";
            m_sdQcsd->Query();
            TsdQcsh *p=new TsdQcsh();
            SetActionID(1);
            p->Assign(this);
            AddRecord((void *)p,p->QcshCode);
            m_Query->Next();
        }
        MoveFirst();
    }
    m_Query->Close();
    return Count;
}
//---------------------------------------------------------------------------
bool TsdQcsh::Find(AnsiString WhereStr)
{
    AnsiString m_SqlStr;
    if(WhereStr.IsEmpty()==true)
        throw Exception("查找表达式不能为空");
    m_SqlStr="select * from sdQcsh 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_sdQcsd->FilterString="QcsdCode='"+m_QcshCode+"'";
        m_sdQcsd->OrderString="QcsdLine";
        m_sdQcsd->Query();
        m_Query->Close();
        return true;
    }
}
//---------------------------------------------------------------------------
void TsdQcsh::Check(int IsCheck)
{
    if(this->Count>0)
    {
      try
      {
        m_StoredProc->ProcedureName="sdQcsh_Check";
        m_StoredProc->Parameters->Clear();

        if(IsCheck==1)
        {
          QcshCheck=1;
          QcshChecker=g_sdUserCode;
          QcshCheckDate=g_sdCurDate;
          m_StoredProc->Parameters->CreateParameter("@W_QcshCode",ftString,pdInput,20,b_QcshCode);
          m_StoredProc->Parameters->CreateParameter("@QcshCheck",ftSmallint,pdInput,2,1);
          m_StoredProc->Parameters->CreateParameter("@QcshChecker",ftString,pdInput,20,g_sdUserCode);
          m_StoredProc->Parameters->CreateParameter("@QcshCheckDate",ftString,pdInput,10,g_sdCurDate);

          m_StoredProc->ExecProc();
          m_StoredProc->Close();
        }
        else
        {
          QcshCheck=0;
          QcshChecker="";
          QcshCheckDate="";
          AnsiString temp="";
          m_StoredProc->Parameters->CreateParameter("@W_QcshCode",ftString,pdInput,20,b_QcshCode);
          m_StoredProc->Parameters->CreateParameter("@QcshCheck",ftSmallint,pdInput,2,0);
          m_StoredProc->Parameters->CreateParameter("@QcshChecker",ftString,pdInput,20,temp);
          m_StoredProc->Parameters->CreateParameter("@QcshCheckDate",ftString,pdInput,10,temp);

          m_StoredProc->ExecProc();
          m_StoredProc->Close();
          }
          TsdQcsh *p=(TsdQcsh*)Records(CurRecNo);
          p->Assign(this);
          BackupValue();
       }
       catch(Exception &e)
       {
          m_QcshCheck=b_QcshCheck;
          m_QcshChecker=b_QcshChecker;
          m_QcshCheckDate=b_QcshCheckDate;
          throw Exception(e.Message);
       }
     }
}
//---------------------------------------------------------------------------
AnsiString TsdQcsh::GetItemValue(euQcsd FieldName)
{
    return m_sdQcsd->GetFieldValue(FieldName);
}
//---------------------------------------------------------------------------
void TsdQcsh::SetItemValue(euQcsd FieldName, AnsiString value)
{
    m_sdQcsd->SetFieldValue(FieldName,value);
}
//---------------------------------------------------------------------------
int __fastcall TsdQcsh::GetItemCount()
{
    return m_sdQcsd->Count;
}
//---------------------------------------------------------------------------
int __fastcall TsdQcsh::GetCurItemNo()
{
    return m_sdQcsd->CurRecNo;
}
//---------------------------------------------------------------------------
char __fastcall TsdQcsh::GetCurItemStatus()
{
    return m_sdQcsd->CurStatus;
}
//---------------------------------------------------------------------------
AnsiString __fastcall TsdQcsh::GetItemBookMark()
{
    return m_sdQcsd->BookMark;
}
//---------------------------------------------------------------------------
void TsdQcsh::NewDetail()
{
    m_sdQcsd=new TsdQcsd(DataComm);
}

void TsdQcsh::DeleteDetail()
{
    delete m_sdQcsd;
}

//**************************************
//     TsdQcsd
//**************************************
//--------------------------------------------------------------
void __fastcall TsdQcsd:: SetQcsdCode(AnsiString value)
{
 if(value.IsEmpty())
  throw Exception("质检单号不能为空!");
 if(value.Length()>18)
  throw Exception("质检单号长度不能大于18");
 m_QcsdCode=value;
}
void __fastcall TsdQcsd:: SetQcsdLine(int    value)
{
 if(value<=0)
  throw Exception("质检单行号不能小于等于零");
 if(value!=m_QcsdLine)
 {
  m_Query->Close();
  m_Query->SQL->Clear();
  m_Query->SQL->Add("select Qcsdline from sdQcsd where Qcsdcode='"+m_QcsdCode+"' and Qcsdline='"+value+"'");
  m_Query->Open();
  if(m_Query->RecordCount > 0)
  {
    m_Query->Close();
    throw Exception("质检单行号已存在!");
  }
  m_Query->Close();
 }
 m_QcsdLine=value;
}
void __fastcall TsdQcsd:: SetQcsdFLine(int    value)
{
 if(value<=0)
  throw Exception("送检单行号不能小于等于零");
 m_QcsdFLine=value;
}
void __fastcall TsdQcsd:: SetQcsdGoods(AnsiString value)
{
 if(value.IsEmpty())
  throw Exception("物料编码不能为空");
 if(value.Length()>18)
  throw Exception("物料编码长度不能大于18");
 if(value!=m_QcsdGoods)
 {
   m_Query->Close();
   m_Query->SQL->Clear();
   m_Query->SQL->Add(" select goodscode from sdgoods where ");
   m_Query->SQL->Add(" goodscode='"+value+"'");
   m_Query->Open();
   if(m_Query->RecordCount<=0)
   {
    m_Query->Close();
     throw Exception("物料编码'"+value+"'未定义");
   }
   m_Query->Close();
 }
 m_QcsdGoods=value;
}
void __fastcall TsdQcsd:: SetQcsdTrd(AnsiString value)
{
 if(value.IsEmpty())
  throw Exception("技术要求代码不能为空");
 if(value.Length()>18)
  throw Exception("技术要求代码长度不能大于18");
 if(value!=m_QcsdTrd)
 {
   m_Query->Close();
   m_Query->SQL->Clear();
   m_Query->SQL->Add(" select TrdCode from sdTrd where ");
   m_Query->SQL->Add(" TrdCode='"+value+"'");
   m_Query->Open();
   if(m_Query->RecordCount<=0)
   {
    m_Query->Close();
    throw Exception("技术要求'"+value+"'未定义");
   }
   m_Query->Close();
 }
 m_QcsdTrd=value;
}
void __fastcall TsdQcsd:: SetQcsdDQty(double  value)
{
 if(value <= 0)
  throw Exception("送检数量数量必须大于零");
 m_QcsdDQty=value;
}
void __fastcall TsdQcsd:: SetQcsdCQty(double  value)
{
 if(value < 0)
  throw Exception("实检数量数量不能小于零");
 if(value > m_QcsdDQty)
  throw Exception("实检数量数量不能大于送检数量");
 m_QcsdCQty=value;
}
void __fastcall TsdQcsd:: SetQcsdYQty(double  value)
{
 if(value < 0)
  throw Exception("合格数量数量不能小于零");
 if(value > m_QcsdCQty)
  throw Exception("合格数量数量不能大于实检数量");
 m_QcsdYQty=value;
}
void __fastcall TsdQcsd:: SetQcsdNQty(double  value)
{
  m_QcsdNQty=m_QcsdCQty-m_QcsdYQty;
}
void __fastcall TsdQcsd:: SetQcsdMode(int    value)
{
 if(value < 1 || value >5)
  throw Exception("不合格处理方式只能为:1-退货,2-全检,3-回用,4-换货,5-返工/修");
 m_QcsdMode=value;
}
void __fastcall TsdQcsd:: SetQcsdState(int    value)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -