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

📄 mscmbh.cpp

📁 科思ERP部分源码及控件
💻 CPP
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop
#include "mScmbh.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)
TKSScmbh *sdScmbh;
//---------------------------------------------------------------------------
__fastcall TKSScmbh::TKSScmbh()
  :TKSMidBase()
{
}
//---------------------------------------------------------------------------
void __fastcall TKSScmbh::ValidHeadValues()
{

   AnsiString  l_ScmbhCode;
   AnsiString  b_ScmbhCode;
   l_ScmbhCode=GetMasterValue("ScmbhCode");
   b_ScmbhCode=GetMasterOldValue("ScmbhCode");
    if(l_ScmbhCode.IsEmpty())
        throw Exception("更改单号不能为空!");
    if(l_ScmbhCode.Length()>18)
      throw Exception("更改单号长度不能超过18");


   AnsiString  l_ScmbhDate;
   l_ScmbhDate=GetMasterValue("ScmbhDate");
   if (l_ScmbhDate.IsEmpty())
       throw Exception("更改日期不能为空!");
    if(l_ScmbhDate.Length()>10)
        throw Exception("更改日期长度不能大于10");

   AnsiString  l_ScmbhFmonth;
   l_ScmbhFmonth=GetMasterValue("ScmbhFmonth");
    if(l_ScmbhFmonth.IsEmpty()==true)
      throw Exception("财务月份不能为空");
    if(l_ScmbhFmonth.Length()>8)
      throw Exception("财务月份不能超过8");
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("SELECT Fcmonth FROM sdFc Where Fcmonth='"+l_ScmbhFmonth+"'");
      Query->Open();
      if(Query->RecordCount<=0)
      {
        Query->Close();
        throw Exception("财务月份 "+l_ScmbhFmonth+" 未定义");
      }
     Query->Close();

   int l_ScmbhCheck;
   l_ScmbhCheck=GetMasterValue("ScmbhCheck");
    if(l_ScmbhCheck!=0 && l_ScmbhCheck!=1)
      throw Exception("审核标志只能取值0-未审核1-已审");

/*
   AnsiString  l_ScmbhChecker;
   int  l_ScmbhCheck;
   l_ScmbhChecker=GetMasterValue("ScmbhChecker");
   l_ScmbhCheck=GetMasterValue("ScmbhCheck");
    if(l_ScmbhCheck==1)
    {
      if(l_ScmbhChecker.IsEmpty())
        throw Exception("审核员代码不能为空");
      if(l_ScmbhChecker.Length()>18)
        throw Exception("审核员代码长度不能大于18");
        Query->Close();
        Query->SQL->Clear();
        Query->SQL->Add("select usercode from sduser where usercode='"+l_ScmbhChecker+"'");
        Query->Open();
        if(Query->RecordCount<=0)
        {
          Query->Close();
          throw Exception("审核员代码未定义或没有审核权限");
        }
        Query->Close();
      }
  */

   AnsiString  l_ScmbhCheckDate;

   l_ScmbhCheckDate=GetMasterValue("ScmbhCheckDate");
   l_ScmbhCheck=GetMasterValue("ScmbhCheck");
    if(l_ScmbhCheck==1)
    {
      if(l_ScmbhCheckDate.IsEmpty())
        throw Exception("审核日期不能为空");
    }

/*
   AnsiString  l_ScmbhUser;
   l_ScmbhUser=GetMasterValue("ScmbhUser");
    if(l_ScmbhUser.IsEmpty())
      throw Exception("操作员代码不能为空");
    if(l_ScmbhUser.Length()>18)
      throw Exception("操作员代码长度不能大于18");
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select usercode from sduser where usercode='"+l_ScmbhUser+"'");
      Query->Open();
      if(Query->RecordCount<=0)
      {
        Query->Close();
        throw Exception("操作员代码:"+l_ScmbhUser+"未定义");
      }
      Query->Close();
 */

   AnsiString  l_ScmbhDesc;
   l_ScmbhDesc=GetMasterValue("ScmbhDesc");
    if(l_ScmbhDesc.IsEmpty())
        throw Exception("更改原因不能为空");
    if(l_ScmbhDesc.Length()>40)
        throw Exception("更改原因长度不能大于40");

}
//---------------------------------------------------------------------------
void __fastcall TKSScmbh::ValidItemValues()
{

   AnsiString  l_ScmbdCode;
   l_ScmbdCode=GetDetailValue("ScmbdCode");
   AnsiString  b_ScmbdCode;
   b_ScmbdCode=GetDetailOldValue("ScmbdCode");
    if(l_ScmbdCode.IsEmpty())
      throw Exception("更改单号不能为空");

   AnsiString  l_ScmbdGoods;
   AnsiString  b_ScmbdGoods;

   l_ScmbdCode=GetDetailValue("ScmbdCode");
   l_ScmbdGoods=GetDetailValue("ScmbdGoods");
   b_ScmbdGoods=GetDetailOldValue("ScmbdGoods");
    if(l_ScmbdGoods.IsEmpty())
      throw Exception("物料编码不能为空");
    if(l_ScmbdGoods.Length()>18)
      throw Exception("物料编码长度不能大于18");
    if(l_ScmbdGoods.LowerCase()!=b_ScmbdGoods.LowerCase())
    {
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select goodsName from sdgoods,sdscd where goodscode=SCDGOODS and goodsCode='"+l_ScmbdGoods+"'");
      Query->Open();
      if(Query->RecordCount<=0)
      {
        Query->Close();
        throw Exception("物料编码 "+l_ScmbdGoods+" 不存在或无标准成本");
      }
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select  * from sdScmbd where Scmbdcode='"+l_ScmbdCode+"' and Scmbdgoods='"+l_ScmbdGoods+"'");
      Query->Open();
      if(Query->RecordCount>0)
      {
        Query->Close();
         throw Exception("物料 "+AnsiString(l_ScmbdGoods)+"已调整");
      }
      Query->Close();
    }


   int l_ScmbdLine;

   l_ScmbdCode=GetDetailValue("ScmbdCode");
   l_ScmbdLine=GetDetailValue("ScmbdLine");
    if(l_ScmbdCode.IsEmpty())
      throw Exception("更改单号不能为空");
    if(l_ScmbdLine<0)
      throw Exception("行号不能小于零");

  double l_ScmbdOCost;
   l_ScmbdOCost=GetDetailValue("ScmbdOCost");
   if (l_ScmbdOCost<0)
     throw Exception("老成本不能小于零");

  double l_ScmbdNCost;
   l_ScmbdNCost=GetDetailValue("ScmbdNCost");
   if (l_ScmbdNCost<0)
     throw Exception("新成本不能小于零");

   AnsiString  l_ScmbdDesc;
   l_ScmbdDesc=GetDetailValue("ScmbdDesc");
    if(l_ScmbdDesc.Length()>40)
      throw Exception("备注长度不能超过40");
}
//---------------------------------------------------------------------------
void __fastcall TKSScmbh::CmdExec(AnsiString Param)
{

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

⌨️ 快捷键说明

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