📄 msugh.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "mSugh.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
TKSSugh *sdSugh;
//---------------------------------------------------------------------------
__fastcall TKSSugh::TKSSugh()
:TKSMidBase()
{
}
//---------------------------------------------------------------------------
void __fastcall TKSSugh::ValidHeadValues()
{
AnsiString m_SughCode;
AnsiString b_SughCode;
m_SughCode=GetMasterValue("SughCode");
b_SughCode=GetMasterOldValue("SughCode");
if(m_SughCode.IsEmpty())
throw Exception("备货单号不能为空!");
if(m_SughCode.Length()>18)
throw Exception("备货单号长度不能超过18");
AnsiString m_SughDate;
m_SughDate=GetMasterValue("SughDate");
if (m_SughDate.IsEmpty())
throw Exception("备货日期不能为空!");
int m_SughType;
m_SughType=GetMasterValue("SughType");
if(m_SughType!=1&&m_SughType!=2&&m_SughType!=3)
throw Exception("备货类型只能取值1-销售备货,2-生产备货,3-其它备货货");
AnsiString m_SughDesc;
m_SughDesc=GetMasterValue("SughDesc");
if(m_SughDesc.Length()>40)
throw Exception("备注长度不能超过40");
/*
AnsiString m_SughUser;
AnsiString b_SughUser;
m_SughUser=GetMasterValue("SughUser");
b_SughUser=GetMasterOldValue("SughUser");
if(m_SughUser.IsEmpty())
throw Exception("操作员代码不能为空");
if(m_SughUser.Length()>18)
throw Exception("操作员代码长度不能大于18");
if(m_SughUser!=b_SughUser)
{
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("select usercode from sduser where usercode='"+m_SughUser+"'");
Query->Open();
if(Query->RecordCount<=0)
{
Query->Close();
throw Exception("操作员代码:"+m_SughUser+"未定义");
}
Query->Close();
}
*/
int m_SughCheck;
m_SughCheck=GetMasterValue("SughCheck");
if(m_SughCheck!=0 && m_SughCheck!=1)
throw Exception("审核标志只能取值0-未审核1-已审");
/*
AnsiString m_SughChecker;
AnsiString b_SughChecker;
m_SughChecker=GetMasterValue("SughChecker");
b_SughChecker=GetMasterOldValue("SughChecker");
int m_SughCheck;
m_SughCheck=GetMasterValue("SughCheck");
if(m_SughCheck==1)
{
if(m_SughChecker.IsEmpty())
throw Exception("审核员代码不能为空");
if(m_SughChecker.Length()>18)
throw Exception("审核员代码长度不能大于18");
if(m_SughChecker!=b_SughChecker)
{
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("select keepercode from sdkeeper where keepercode='"+m_SughChecker+"' and Keepercheck=1");
Query->Open();
if(Query->RecordCount<=0)
{
Query->Close();
throw Exception("审核员代码未定义或没有审核权限");
}
Query->Close();
}
}
else
b_SughChecker="";
*/
AnsiString m_SughCheckDate;
m_SughCheckDate=GetMasterValue("SughCheckDate");
m_SughCheck=GetMasterValue("SughCheck");
if(m_SughCheck==1)
{
if(m_SughCheckDate.IsEmpty())
throw Exception("审核日期不能为空");
}
int m_SughCancel;
m_SughCancel=GetMasterValue("SughCancel");
AnsiString m_SughCancelDate;
m_SughCancelDate=GetMasterValue("SughCancelDate");
AnsiString m_SughSysDate;
m_SughSysDate=GetMasterValue("SughSysDate");
}
//---------------------------------------------------------------------------
void __fastcall TKSSugh::ValidItemValues()
{
AnsiString m_SugdCode;
m_SugdCode=GetDetailValue("SugdCode");
int m_SugdLine;
int b_SugdLine;
m_SugdLine=GetDetailValue("SugdLine");
b_SugdLine=GetDetailOldValue("SugdLine");
m_SugdCode=GetDetailValue("SugdCode");
if(m_SugdLine<0)
throw Exception("行号不能小于零");
if(m_SugdLine!=b_SugdLine)
{
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("select Sugdcode,SugDLINE from sdSugd where SugDCODE='"+m_SugdCode+"' and SugDLINE='"+ m_SugdLine+"'");
Query->Open();
if(Query->RecordCount>0)
{
Query->Close();
throw Exception("行号 "+AnsiString(m_SugdLine)+" 已存在");
}
Query->Close();
}
AnsiString m_SugdGoods;
AnsiString b_SugdGoods;
m_SugdGoods=GetDetailValue("SugdGoods");
b_SugdGoods=GetDetailOldValue("SugdGoods");
if(m_SugdGoods.IsEmpty())
throw Exception("物料编码不能为空");
if(m_SugdGoods.Length()>18)
throw Exception("物料编码长度不能大于18");
if(m_SugdGoods!=b_SugdGoods)
{
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("select GOODSCODE from sdgoods where GOODSCODE='"+m_SugdGoods+"'");
Query->Open();
if(Query->RecordCount<=0)
{
Query->Close();
throw Exception("物料编码 "+m_SugdGoods+" 不存在");
}
Query->Close();
}
AnsiString m_SugdUnit;
AnsiString b_SugdUnit;
m_SugdUnit=GetDetailValue("SugdUnit");
b_SugdUnit=GetDetailOldValue("SugdUnit");
if(m_SugdUnit.IsEmpty())
throw Exception("计量单位不能为空");
if(m_SugdUnit.Length()>18)
throw Exception("计量单位长度不能超过18");
if (m_SugdUnit!=b_SugdUnit)
{
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("SELECT UnitCode FROM sdUnit where UnitCode='"+m_SugdUnit+"'");
Query->Open();
if(Query->RecordCount<1 )
{
Query->Close();
throw Exception("计量单位'"+m_SugdUnit+"'不存在");
}
Query->Close();
}
double m_SugdQty;
m_SugdQty=GetDetailValue("SugdQty");
if (m_SugdQty<0)
throw Exception("备货数量不能小于零");
AnsiString m_SugdLoc;
AnsiString b_SugdLoc;
m_SugdLoc=GetDetailValue("SugdLoc");
b_SugdLoc=GetDetailOldValue("SugdLoc");
if(m_SugdLoc.IsEmpty())
throw Exception("备货货位不能为空");
if(m_SugdLoc.Length()>18)
throw Exception("备货货位长度不能超过18");
if (m_SugdLoc!=b_SugdLoc)
{
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("select LocCode from sdLoc where LocCode='"+m_SugdLoc+"'");
Query->Open();
if(Query->RecordCount<1 )
{
Query->Close();
throw Exception("备货货位'"+m_SugdLoc+"'不存在");
}
Query->Close();
}
AnsiString m_SugdDesc;
m_SugdDesc=GetDetailValue("SugdDesc");
if(m_SugdDesc.Length()>40)
throw Exception("备货原因不能超过40");
double m_SugdRQty;
m_SugdRQty=GetDetailValue("SugdRQty");
if (m_SugdRQty<0)
throw Exception("备货数量不能小于零");
}
//---------------------------------------------------------------------------
void __fastcall TKSSugh::CmdExec(AnsiString Param)
{
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -