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

📄 mrwt.cpp

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

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

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

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

   AnsiString  l_RwtGoods;
   AnsiString  b_RwtGoods;
   l_RwtGoods=GetMasterValue("RwtGoods");
   b_RwtGoods=GetMasterOldValue("RwtGoods");
   if(l_RwtGoods.LowerCase()!=b_RwtGoods.LowerCase())
   {
    if (l_RwtGoods.IsEmpty() )
       throw Exception("产品编码不能为空!");
    if(l_RwtGoods.Length()>18)
      throw Exception("产品编码长度不能超过18");

  }

   AnsiString  l_RwtLoc;
   AnsiString  b_RwtLoc;

   l_RwtGoods=GetMasterValue("RwtGoods");
   l_RwtLoc=GetMasterValue("RwtLoc");
   b_RwtLoc=GetMasterOldValue("RwtLoc");
    if(l_RwtLoc.IsEmpty()==true)
      throw Exception("货位编码不能为空");
    if(l_RwtLoc.Length()>18)
      throw Exception("货位编码长度不能超过18");
    if(l_RwtLoc!=b_RwtLoc)
    {
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select LocCode from sdLoc where LocCode='"+l_RwtLoc+"'");
      Query->Open();
      if(Query->RecordCount<1 )
      {
        Query->Close();
        throw Exception("货位编码'"+l_RwtLoc+"'未定义");
      }
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("SELECT * FROM sdGoods ,sdlg where ( goodstype='1' or goodstype='2') and GOODSCODE=LGGOODSCODE and LGLOCCODE='"+l_RwtLoc+"' and goodscode='"+ l_RwtGoods+"' order by goodscode");
      Query->Open();
      if(Query->RecordCount<1 )
      {
        Query->Close();
        throw Exception("物料编码 '"+ l_RwtGoods+"'不是成品、半成品或不在该货位!");
      }
      Query->Close();
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("select RwtLoc from sdRwt where RwtLoc='"+l_RwtLoc+"' and RwtGoods='"+l_RwtGoods+"'");
      Query->Open();
      if(Query->RecordCount>0 )
      {
        Query->Close();
        throw Exception("货位物料工时已存在");
      }
    }

   AnsiString  l_RwtUnit;
   l_RwtUnit=GetMasterValue("RwtUnit");
    if(l_RwtUnit.IsEmpty())
      throw Exception("计量单位编码不能为空");
    if(l_RwtUnit.Length()>18)
      throw Exception("计量单位编码长度不能超过18");
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("SELECT UnitCode FROM sdUnit where UnitCode='"+l_RwtUnit+"'");
      Query->Open();
      if(Query->RecordCount<1 )
      {
        Query->Close();
        throw Exception("计量单位编码'"+l_RwtUnit+"'未定义");
      }
      Query->Close();

  double l_RwtTime;
   l_RwtTime=GetMasterValue("RwtTime");
    if(l_RwtTime<0)
      throw Exception("定额工时不能小于零");

   AnsiString  l_RwtEdate;
   l_RwtEdate=GetMasterValue("RwtEdate");
  if(l_RwtEdate.IsEmpty())
    throw Exception("生效日期不能为空");
  if(l_RwtEdate.Length()>10)
    throw Exception("生效日期长度不能大于10");

   AnsiString  l_RwtIdate;

   l_RwtIdate=GetMasterValue("RwtIdate");
   l_RwtEdate=GetMasterValue("RwtEdate");
  if(l_RwtEdate.IsEmpty())
    throw Exception("生效日期不能为空");
  if(l_RwtIdate.IsEmpty()==false)
  {
   if(l_RwtIdate.Length()>10)
     throw Exception("失效日期长度不能大于10");
   if(StrToDate(l_RwtIdate)<StrToDate(l_RwtEdate))
     throw Exception("失效日期不能早于生效日期");
  }

 /*
   AnsiString  l_RwtUser;
   AnsiString  b_RwtUser;
   l_RwtUser=GetMasterValue("RwtUser");
   b_RwtUser=GetMasterOldValue("RwtUser");
  if(l_RwtUser.IsEmpty())
    throw Exception("操作员编码不能为空");
  if(l_RwtUser.Length()>18)
    throw Exception("操作员编码长度不能大于18");
  if(l_RwtUser!=b_RwtUser)
    {
      Query->Close();
      Query->SQL->Clear();
      Query->SQL->Add("SELECT UserCODE FROM SDUser WHERE UserCODE='" +l_RwtUser+"'");
      Query->Open();
      if(Query->RecordCount<=0)
      {
        Query->Close();
        throw Exception("操作员编码"+l_RwtUser+"'未定义");
      }
      Query->Close();
    }
  */
}
//---------------------------------------------------------------------------
void __fastcall TKSRwt::CmdExec(AnsiString Param)
{

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

⌨️ 快捷键说明

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