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

📄 malfh.cpp

📁 科思ERP部分源码及控件
💻 CPP
📖 第 1 页 / 共 2 页
字号:
//---------------------------------------------------------------------------

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

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

#pragma package(smart_init)
TKSAlfh *sdAlfh;
//---------------------------------------------------------------------------
__fastcall TKSAlfh::TKSAlfh()
  :TKSMidBase()
{
}
//---------------------------------------------------------------------------
void __fastcall TKSAlfh::ValidHeadValues()
{
  AnsiString  m_AlfhCode;
   AnsiString  b_AlfhCode;
   m_AlfhCode=GetMasterValue("AlfhCode");
   b_AlfhCode=GetMasterOldValue("AlfhCode");
    if(m_AlfhCode.IsEmpty())
        throw Exception("调拔单编码不能为空!");
    if(m_AlfhCode.Length()>18)
      throw Exception("调拔单号长度不能大于18");

    b_AlfhCode = m_AlfhCode;

   AnsiString  m_AlfhDate;
   m_AlfhDate=GetMasterValue("AlfhDate");
    if(m_AlfhDate.IsEmpty())
      throw Exception("调拔日期不能为空");

   AnsiString  m_AlfhFmonth;
   AnsiString  b_AlfhFmonth;
   m_AlfhFmonth=GetMasterValue("AlfhFmonth");
   b_AlfhFmonth=GetMasterOldValue("AlfhFmonth");
//    AnsiString s;
    if(m_AlfhFmonth.IsEmpty())
      throw Exception("财务月份不能为空");
/*
    if(m_AlfhFmonth!=b_AlfhFmonth)
    {
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select fcmonth from sdfc where fcmonth='"+m_AlfhFmonth+"'");
      Query->Open();
      if(Query->RecordCount<=0)
      {
        Query->Close();
        throw Exception("财务月份:"+m_AlfhFmonth+"未定义");
      }
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select fcmonth from sdfc where fccurrent=1");
      Query->Open();
      if(Query->RecordCount<=0)
      {
        Query->Close();
        throw Exception("未定义当前财务月份");
      }
      s=Query->FieldValues["FcMonth"];
      if(m_AlfhFmonth<s)
      {
        Query->Close();
        throw Exception("财务月份不能小于当前月份");
      }
      Query->Close();
    }
*/

   AnsiString  m_AlfhPosType;
   AnsiString  b_AlfhPosType;
   m_AlfhPosType=GetMasterValue("AlfhPosType");
   b_AlfhPosType=GetMasterOldValue("AlfhPosType");
    if(m_AlfhPosType.IsEmpty())
      throw Exception("收发存项目编码不能为空");
    if(m_AlfhPosType.Length()>18)
      throw Exception("项目编码长度不能大于18");
    if(m_AlfhPosType!=b_AlfhPosType)
    {
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select postypecode from sdpostype where postypecode='"+m_AlfhPosType+"'");
      Query->Open();
      if(Query->RecordCount<=0)
      {
        Query->Close();
        throw Exception("收发存项目编码:"+m_AlfhPosType+"未定义");
      }
      Query->Close();
    }

   AnsiString  m_AlfhODept;
   AnsiString  b_AlfhODept;
   m_AlfhODept=GetMasterValue("AlfhODept");
   b_AlfhODept=GetMasterOldValue("AlfhODept");
    if(m_AlfhODept.IsEmpty())
      throw Exception("转出部门编码不能为空");
    if(m_AlfhODept.Length()>18)
      throw Exception("转出部门编码长度不能大于18");
    if(m_AlfhODept!=b_AlfhODept)
    {
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select deptcode from sddept where deptcode='"+m_AlfhODept+"'");
      Query->Open();
      if(Query->RecordCount<=0)
      {
        Query->Close();
        throw Exception("转出部门编码:"+m_AlfhODept+"未定义");
      }
      Query->Close();
    }

   AnsiString  m_AlfhIDept;
   AnsiString  b_AlfhIDept;
   m_AlfhIDept=GetMasterValue("AlfhIDept");
   b_AlfhIDept=GetMasterOldValue("AlfhIDept");
    if(m_AlfhIDept.IsEmpty())
      throw Exception("转入部门编码不能为空");
    if(m_AlfhIDept.Length()>18)
      throw Exception("转入部门编码长度不能大于18");
    if(m_AlfhIDept!=b_AlfhIDept)
    {
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select deptcode from sddept where deptcode='"+m_AlfhIDept+"'");
      Query->Open();
      if(Query->RecordCount<=0)
      {
        Query->Close();
        throw Exception("转入部门编码:"+m_AlfhIDept+"未定义");
      }
      Query->Close();
    }

   int m_AlfhType;
   m_AlfhType=GetMasterValue("AlfhType");
    if(m_AlfhType!=1)
      throw Exception("调拔类型只能取值1-库存调拔");

   AnsiString  m_AlfhDesc;
   m_AlfhDesc=GetMasterValue("AlfhDesc");
    if(m_AlfhDesc.Length()>40)
      throw Exception("备注长度不能大于40");

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

/*
   AnsiString  m_AlfhChecker;
   AnsiString  b_AlfhChecker;
   m_AlfhChecker=GetMasterValue("AlfhChecker");
   b_AlfhChecker=GetMasterOldValue("AlfhChecker");
   int  m_AlfhCheck;
   m_AlfhCheck=GetMasterValue("AlfhCheck");
    if(m_AlfhCheck==1)
    {
      if(m_AlfhChecker.IsEmpty())
        throw Exception("审核员代码不能为空");
      if(m_AlfhChecker.Length()>18)
        throw Exception("审核员代码长度不能大于18");
      if(m_AlfhChecker!=b_AlfhChecker)
      {
        Query->Close();
        Query->SQL->Clear();
        Query->SQL->Add("select keepercode from sdkeeper where keepercode='"+m_AlfhChecker+"' and Keepercheck=1");
        Query->Open();
        if(Query->RecordCount<=0)
        {
          Query->Close();
          throw Exception("审核员代码未定义或没有审核权限");
        }
        Query->Close();
      }
    }
    else
      b_AlfhChecker="";
*/

   AnsiString  m_AlfhCheckDate;
   m_AlfhCheckDate=GetMasterValue("AlfhCheckDate");

   m_AlfhCheck=GetMasterValue("AlfhCheck");
    if(m_AlfhCheck==1)
    {
      if(m_AlfhCheckDate.IsEmpty())
        throw Exception("审核日期不能为空");
    }

   int m_AlfhInvFlg;
   m_AlfhInvFlg=GetMasterValue("AlfhInvFlg");
    //库存控制不能录入

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

/*
   AnsiString  m_AlfhKeeper;
   AnsiString  b_AlfhKeeper;
   m_AlfhKeeper=GetMasterValue("AlfhKeeper");
   b_AlfhKeeper=GetMasterOldValue("AlfhKeeper");
    if(m_AlfhKeeper.IsEmpty())
      throw Exception("仓管员代码不能为空");
    if(m_AlfhKeeper.Length()>18)
      throw Exception("仓管员代码长度不能大于18");
    if(m_AlfhKeeper!=b_AlfhKeeper)
    {
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select keepercode from sdkeeper where keepercode='"+m_AlfhKeeper+"'");
      Query->Open();
      if(Query->RecordCount<=0)
      {
        Query->Close();
        throw Exception("仓管员:"+m_AlfhKeeper+"未定义");
      }
      Query->Close();
    }
*/

   int m_AlfhCancel;
   m_AlfhCancel=GetMasterValue("AlfhCancel");
    if(m_AlfhCancel!=0 && m_AlfhCancel!=1)
      throw Exception("取消标志只能取值0-正常 1-取消");

⌨️ 快捷键说明

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