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

📄 msreth.cpp

📁 科思ERP部分源码及控件
💻 CPP
📖 第 1 页 / 共 3 页
字号:
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSretdSogCode()
{
   AnsiString  m_SretdSogCode;
   AnsiString  b_SretdSogCode;
   m_SretdSogCode=ReturnNeedValue(GetDetailValue("SretdSogCode"),"");
   b_SretdSogCode=ReturnNeedValue(GetDetailOldValue("SretdSogCode"),"");
    if(GetMasterValue("SrethType")==1)
    {
      if(m_SretdSogCode.IsEmpty())
        throw Exception("发货单单号不能为空!!");
      if(m_SretdSogCode!=b_SretdSogCode)
      {
        Query->Close();
        Query->SQL->Clear();
        Query->SQL->Add("select SoghCode,SoghCheck,SoghCancel from sdSogh where SoghCode='"+m_SretdSogCode+"'" );
        Query->Open();
        if(Query->RecordCount>0)
        {
          if(Query->FieldValues["SoghCheck"]==0)
          {
            Query->Close();
            throw Exception("单据未审核,不能引用!");
          }
          if(Query->FieldValues["SoghCancel"]==1)
          {
            Query->Close();
            throw Exception("单据已取消,不能引用!");
          }
        }
        else
        {
          Query->Close();
          throw Exception("该引用单据不存在!");
        }
        Query->Close();
      }
    }
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSretdSogdLine()
{                            /*/
   int m_SretdSogdLine;
   int b_SretdSogdLine;
   AnsiString m_SretdSogCode=ReturnNeedValue(GetDetailValue("SretdSogCode"),"");
   m_SretdSogdLine=ReturnNeedValue(GetDetailValue("SretdSogdLine"),0);
   b_SretdSogdLine=ReturnNeedValue(GetDetailOldValue("SretdSogdLine"),0);
    if(GetMasterValue("SrethType")==1)
    {                        
      if(m_SretdSogdLine<1)
        throw Exception("发货单行号不能为空");
      if(m_SretdSogCode.IsEmpty())
        throw Exception("发货单号不能为空");
      if(m_SretdSogCode!=b_SretdSogdLine)
      {
        Query->Close();
        Query->SQL->Clear();
        Query->SQL->Add("select SogdGoods,SogdUnit,SogdConv from sdSogd where SogdCode='"+m_SretdSogCode+"' and SogdLine="+m_SretdSogdLine);
        Query->Open();
        if(Query->RecordCount>0)
        {
         ///  m_SretdGoods=Query->FieldValues["SogdGoods"];
           m_SretdUnit=Query->FieldValues["SogdUnit"];
           m_SretdConv=Query->FieldValues["SogdConv"];///
        }
        else
        {
           Query->Close();
           throw Exception("发货单:'"+m_SretdSogCode+"' 或行号:'"+m_SretdSogdLine+"' 不存在!!");
        }
        Query->Close();
      }
    }                                 /*/
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSretdGoods()
{                          /*/
   AnsiString  m_SretdGoods;
   m_SretdGoods=ReturnNeedValue(GetDetailValue("SretdGoods"),"");
    AnsiString  b_SretdGoods;
    b_SretdGoods=ReturnNeedValue(GetDetailOldValue("SretdGoods"),"");
    if(m_SretdGoods.IsEmpty())
      throw Exception("退货货物编码不能为空!!!");
    if(m_SretdGoods!=b_SretdGoods)
    {
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select GoodsName from sdGoods,sdsgd where sgdgoodscode=goodscode and sgdclientcode='"+GetMasterValue("SrethClient")+"' and GoodsCode='"+m_SretdGoods+"'");
      Query->Open();
      if(Query->RecordCount<1)
      {
        Query->Close();
        throw Exception("客户未定义物料或在物料主文件中丢失信息");
      }
      Query->Close();
    }                    /*/
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSretdUnit()
{                        /*/
   AnsiString  m_SretdUnit;
   AnsiString  b_SretdUnit;
   AnsiString m_SretdGoods=ReturnNeedValue(GetDetailValue("SretdGoods"),"");
   m_SretdUnit=ReturnNeedValue(GetDetailValue("SretdUnit"),"");
   b_SretdUnit=ReturnNeedValue(GetDetailOldValue("SretdUnit"),"");
  if(m_SretdUnit.IsEmpty())
    throw Exception("计量单位不能为空!");
  if(m_SretdGoods.IsEmpty())
    throw Exception("退货物料不能为空");
   if(m_SretdUnit!=b_SretdUnit)
  {
    Query->Close();
    Query->SQL->Clear();
    Query->SQL->Add("select gmuconv from sdgmu where gmugoods='"+m_SretdGoods+"' and gmuUnit='"+m_SretdUnit+"'");
    Query->Open();
    if(Query->RecordCount<1)
    {
      Query->Close();
      throw Exception("物料:"+m_SretdGoods+"未定义当前计量单位");
    }
    Query->Close();
  }                    /*/
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSretdConv()
{
  double m_SretdConv;
  AnsiString m_SretdUnit=ReturnNeedValue(GetDetailValue("SretdUnit"),"");
   m_SretdConv=ReturnNeedValue(GetDetailValue("SretdConv"),0);
    if(m_SretdConv<=0)
      throw Exception("换算系数不能小于等于零");
    if(m_SretdUnit.IsEmpty())
      throw Exception("计量单位不能为空");
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSretdQty()
{
  double m_SretdQty;
  double b_SretdQty;
  int m_SretdSogdLine=ReturnNeedValue(GetDetailValue("SretdSogdLine"),0);
  AnsiString m_SretdGoods=ReturnNeedValue(GetDetailValue("SretdGoods"),"");
  AnsiString m_SretdSogCode=ReturnNeedValue(GetDetailValue("SretdSogCode"),"");
   m_SretdQty=ReturnNeedValue(GetDetailValue("SretdQty"),0);
   b_SretdQty=ReturnNeedValue(GetDetailOldValue("SretdQty"),0);
  if(m_SretdQty<=0)
    throw Exception("退货数量需大于零!");
  if(m_SretdGoods.IsEmpty())
    throw Exception("退货物料不能为空");
   if(m_SretdQty!=b_SretdQty)
   {
    if(GetMasterValue("SrethType")==1)
    {
      if(m_SretdSogCode.IsEmpty())
        throw Exception("发货单号不能为空");
      if(m_SretdSogdLine<1)
        throw Exception("发货单行号不能为空");
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select SogdQty,SogdBQty from sdSogd where SogdCode='"+m_SretdSogCode+"' and SogdLine="+IntToStr(m_SretdSogdLine));
      Query->Open();
      if(Query->RecordCount>0)
      {
        if(Query->FieldValues["SogdQty"]-Query->FieldValues["SogdBQty"]<m_SretdQty)
        {
          Query->Close();
          throw Exception("退货数量不能大于可退货数量");
        }
      }
      else
      {
        Query->Close();
        throw Exception("该发货单明细找不到");
      }
      Query->Close();
    }
  }
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSretdPrice()
{
  double m_SretdPrice;
   m_SretdPrice=ReturnNeedValue(GetDetailValue("SretdPrice"),-1);
    if(m_SretdPrice<0)
      throw Exception("单价不能小于零");
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSretdAmt()
{
  double m_SretdAmt;
   m_SretdAmt=ReturnNeedValue(GetDetailValue("SretdAmt"),-1);
    if(m_SretdAmt<0)
      throw Exception("金额不能小于零");
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSretdTaxAmt()
{
  double m_SretdTaxAmt;
   m_SretdTaxAmt=ReturnNeedValue(GetDetailValue("SretdTaxAmt"),-1);
    if(m_SretdTaxAmt<0)
      throw Exception("税额不能小于零");
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSretdLoc()
{                          /*/
   AnsiString  m_SretdLoc;
   AnsiString  b_SretdLoc;
   AnsiString m_SretdGoods=ReturnNeedValue(GetDetailValue("SretdGoods"),"");
   m_SretdLoc=ReturnNeedValue(GetDetailValue("SretdLoc"),"");
   b_SretdLoc=ReturnNeedValue(GetDetailOldValue("SretdLoc"),"");
    if(m_SretdLoc.IsEmpty())
      throw Exception("退货货位不能为空!");
    if(m_SretdGoods.IsEmpty())
      throw Exception("退货物料不能为空");
    if(m_SretdLoc!=b_SretdLoc)
    {
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select loccode from sdLoc,sdLg where loccode=lgloccode and loccode='"+m_SretdLoc+"' and lggoodscode='"+m_SretdGoods+"'");
      Query->Open();
      if(Query->RecordCount<1)
      {
        Query->Close();
        throw Exception("货位:"+m_SretdLoc+"不能存储物料:"+m_SretdGoods);
      }
      Query->Close();
    }                      /*/
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSretdExes()
{
  double m_SretdExes;
   m_SretdExes=ReturnNeedValue(GetDetailValue("SretdExes"),-1);
    if(m_SretdExes<0)
      throw Exception("退货费用需大于零!");
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSretdDesc()
{

}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSretdBatch()
{                          /*/
   AnsiString  m_SretdBatch;
   AnsiString  b_SretdBatch;
   AnsiString m_SretdGoods=ReturnNeedValue(GetDetailValue("SretdGoods"),"");
   m_SretdBatch=ReturnNeedValue(GetDetailValue("SretdBatch"),"");
   b_SretdBatch=ReturnNeedValue(GetDetailOldValue("SretdBatch"),"");
    if(m_SretdBatch.Length()>18)
      throw Exception("批号长度不能大于18");
    if(m_SretdGoods.IsEmpty())
      throw Exception("退货物料不能为空");
    if(m_SretdBatch.IsEmpty()==false && m_SretdBatch!=b_SretdBatch)
    {
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select GoodsBatch from sdgoods where goodscode='"+m_SretdGoods+"'");
      Query->Open();
      if(Query->RecordCount<1)
      {
        Query->Close();
        throw Exception("退货物料不存在");
      }
      else
      {
        if(Query->FieldValues["GoodsBatch"]!=1)
        {
          Query->Close();
          throw Exception("当前物料不能进行批号管理");
        }
      }
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select batchcode from sdbatch where batchcode='"+m_SretdBatch+"'");
      Query->Open();
      if(Query->RecordCount<=0)
      {
        Query->Close();
        throw Exception("批号:"+m_SretdBatch+"未定义");
      }
      Query->Close();
    }                 /*/
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSretdState()
{

}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSretdClose()
{
   int m_SretdClose;
   m_SretdClose=ReturnNeedValue(GetDetailValue("SretdClose"),0);
    if(m_SretdClose!=0 && m_SretdClose!=1)
      throw Exception("结清标志只能取值0-未结清,1-已结清");
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::ValidSretdCloseDate()
{
   AnsiString  m_SretdCloseDate;
   AnsiString  b_SretdCloseDate;
   int m_SretdClose=ReturnNeedValue(GetDetailValue("SretdClose"),0);
   m_SretdCloseDate=ReturnNeedValue(GetDetailValue("SretdCloseDate"),"");
   b_SretdCloseDate=ReturnNeedValue(GetDetailOldValue("SretdCloseDate"),"");
    if(m_SretdClose==1)
    {
      if(m_SretdCloseDate.IsEmpty())
        throw Exception("结清日期不能为空");
    }
}
//---------------------------------------------------------------------------
void __fastcall TKSSreth::CmdExec(AnsiString Param)
{

}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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