📄 mdmah.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#include "mDmah.h"
//---------------------------------------------------------------------------
#pragma hdrstop
#pragma package(smart_init)
TKSDmah *sdDmah;
//---------------------------------------------------------------------------
__fastcall TKSDmah::TKSDmah()
:TKSMidBase()
{
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidHeadValues()
{
//材料分摊单号
ValidDmahCode();
//财务月份
ValidDmahFmonth();
//分摊日期
ValidDmahDate();
//收发类型
ValidDmahPosType();
//备注
ValidDmahDesc();
//操作员
ValidDmahUser();
//审核标志
ValidDmahCheck();
//审核人
ValidDmahChecker();
//审核日期
ValidDmahCheckDate();
//状态
ValidDmahState();
//系统日期
ValidDmahSysDate();
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmahCode() //材料分摊单号
{
AnsiString m_DmahCode;
AnsiString b_DmahCode;
m_DmahCode=GetMasterValue("DmahCode");
b_DmahCode=GetMasterOldValue("DmahCode");
if(m_DmahCode.Length()>18)
throw Exception("分摊单号长度不能大于18!");
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmahFmonth() //财务月份
{
AnsiString m_DmahFmonth;
m_DmahFmonth=GetMasterValue("DmahFmonth");
if(m_DmahFmonth.Length()>6)
throw Exception("财务月份的长度不能大于6!");
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmahDate() //分摊日期
{
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmahPosType() //收发类型
{
AnsiString m_DmahPosType;
AnsiString b_DmahPosType;
m_DmahPosType=GetMasterValue("DmahPosType");
b_DmahPosType=GetMasterOldValue("DmahPosType");
if(m_DmahPosType.Length()>18)
throw Exception("收发存类型长度不能大于18!");
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmahDesc() //备注
{
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmahUser() //操作员
{
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmahCheck() //审核标志
{
int m_DmahCheck;
m_DmahCheck=GetMasterValue("DmahCheck");
if(m_DmahCheck!=0 && m_DmahCheck!=1)
throw Exception("审核标志只能取值(0-未审核,1-已审核)!");
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmahChecker() //审核人
{
int m_DmahCheck;
AnsiString m_DmahChecker;
AnsiString b_DmahChecker;
m_DmahCheck=GetMasterValue("DmahCheck");
m_DmahChecker=GetMasterValue("DmahChecker");
b_DmahChecker=GetMasterOldValue("DmahChecker");
if(m_DmahCheck==1)
{
if(m_DmahChecker!=b_DmahChecker)
{
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("select ProducterCode from sdProducter where ProducterCode='"+m_DmahChecker+"' and ProducterCheck=1");
Query->Open();
if(Query->RecordCount<=0)
{
Query->Close();
throw Exception("审核人'"+m_DmahChecker+"'没有定义或无审核的权限!");
}
Query->Close();
}
}
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmahCheckDate() //审核日期
{
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmahState() //状态
{
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmahSysDate() //系统日期
{
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidItemValues()
{
ValidDmadCode();
ValidDmadLine();
ValidDmadGmtCode();
ValidDmadGmtdLine();
ValidDmadLoc();
ValidDmadGoods();
ValidDmadUnit();
ValidDmadWoCode();
ValidDmadQty();
ValidDmadPrice();
ValidDmadAmt();
ValidDmadDesc();
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmadCode()
{
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmadLine()
{
int m_DmadLine;
m_DmadLine=GetDetailValue("DmadLine");
if(m_DmadLine<=0)
throw Exception("分摊单行号不能小于等于零!");
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmadGmtCode()
{
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmadGmtdLine()
{
int m_DmadGmtdLine;
int b_DmadGmtdLine;
AnsiString m_DmadGmtCode;
m_DmadGmtdLine=GetDetailValue("DmadGmtdLine");
b_DmadGmtdLine=GetDetailOldValue("DmadGmtdLine");
m_DmadGmtCode=GetDetailValue("DmadGmtCode");
if(m_DmadGmtdLine!=b_DmadGmtdLine)
{
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("select * from sdGmtd where GmtdCode='"+m_DmadGmtCode+"' and GmtdLine="+AnsiString(m_DmadGmtdLine));
Query->Open();
if(Query->RecordCount<1)
{
Query->Close();
throw Exception("领料单行号不存在!");
}
Query->Close();
}
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmadLoc()
{
AnsiString m_DmadLoc;
AnsiString b_DmadLoc;
m_DmadLoc=GetDetailValue("DmadLoc");
b_DmadLoc=GetDetailOldValue("DmadLoc");
if(m_DmadLoc.Length()>18)
throw Exception("分摊货位长度不能大于18!");
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmadGoods()
{
AnsiString m_DmadGoods;
AnsiString b_DmadGoods;
AnsiString m_DmadLoc;
m_DmadGoods=GetDetailValue("DmadGoods");
b_DmadGoods=GetDetailOldValue("DmadGoods");
m_DmadLoc=GetDetailValue("DmadLoc");
if(m_DmadGoods.Length()>18)
throw Exception("物料编码长度不能大于18!");
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmadUnit()
{
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmadWoCode()
{
AnsiString m_DmadWoCode;
AnsiString b_DmadWoCode;
m_DmadWoCode=GetDetailValue("DmadWoCode");
b_DmadWoCode=GetDetailOldValue("DmadWoCode");
if(m_DmadWoCode.Length()>18)
throw Exception("工单号长度不能大于18!");
if(m_DmadWoCode!=b_DmadWoCode)
{
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("select * from sdWo where WoCheck=1 and WoClose=0 and WoCancel=0 and Wocode='"+m_DmadWoCode+"'");
Query->Open();
if(Query->RecordCount<=0)
{
Query->Close();
throw Exception("加工单:'"+m_DmadWoCode+"'不存在,或已结清,或已作废,或未审核!");
}
Query->Close();
}
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmadQty()
{
double m_DmadQty;
AnsiString m_DmadGmtCode;
int m_DmadGmtdLine;
AnsiString m_DmadLoc;
AnsiString m_DmadGoods;
m_DmadQty=GetDetailValue("DmadQty");
m_DmadGmtCode=GetDetailValue("DmadGmtCode");
m_DmadGmtdLine=GetDetailValue("DmadGmtdLine");
m_DmadLoc=GetDetailValue("DmadLoc");
m_DmadGoods=GetDetailValue("DmadGoods");
if(m_DmadQty<=0)
throw Exception("分摊数量不能小于等于零!");
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("select DmadQty=GmtdQty-GmtdDqty from sdGmtd where GmtdCode='"+m_DmadGmtCode+"' and GmtdLine="+AnsiString(m_DmadGmtdLine));
Query->Open();
if(Query->RecordCount<1)
{
Query->Close();
throw Exception("领料单资料不存在!");
}
if(Query->FieldValues["DmadQty"]<m_DmadQty)
{
Query->Close();
throw Exception("当前分摊数量大于可分摊数量");
}
Query->Close();
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmadPrice()
{
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmadAmt()
{
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::ValidDmadDesc()
{
}
//---------------------------------------------------------------------------
void __fastcall TKSDmah::CmdExec(AnsiString Param)
{
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -