📄 mwsgm.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#include "mWsgm.h"
//---------------------------------------------------------------------------
#pragma hdrstop
#pragma package(smart_init)
TKSWsgm *sdWsgm;
//---------------------------------------------------------------------------
__fastcall TKSWsgm::TKSWsgm()
:TKSMidBase()
{
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidHeadValues()
{
//工单号
ValidWsgmWo();
//物料编码
ValidWsgmGoods();
//计量单位
ValidWsgmUnit();
//产品结构表来源
ValidWsgmFrom();
//消耗定额
ValidWsgmQty();
//领料批量
ValidWsgmOoq();
//定额领料量
ValidWsgmPQty();
//损耗率
ValidWsgmShl();
//已领量
ValidWsgmGQty();
//报废量
ValidWsgmLQty();
//损坏量
ValidWsgmDQty();
//退料量
ValidWsgmRQty();
//货位
ValidWsgmLoc();
//序号
ValidWsgmSn();
//批号
ValidWsgmBatch();
//工序
ValidWsgmProcess();
//消耗数量
ValidWsgmUQty();
//补料数量
ValidWsgmAQty();
//换料数量
ValidWsgmTQty();
//结清
ValidWsgmClose();
//结清日期
ValidWsgmCloseDate();
//操作员
ValidWsgmUser();
//工单物料表状态
ValidWsgmStatus();
//系统日期
ValidWsgmSysDate();
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmWo() //工单号
{
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmGoods() //物料编码
{
AnsiString m_WsgmWo;
AnsiString m_WsgmGoods;
AnsiString b_WsgmGoods;
m_WsgmWo=GetMasterValue("WsgmWo");
m_WsgmGoods=GetMasterValue("WsgmGoods");
b_WsgmGoods=GetMasterOldValue("WsgmGoods");
if(UpperCase(m_WsgmGoods)!=UpperCase(b_WsgmGoods))
{
//唯一性
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("select WsgmGoods from sdWsgm Where WsgmWo='"+m_WsgmWo+"' and WsgmGoods='"+m_WsgmGoods+"'");
Query->Open();
if(Query->RecordCount>0)
{
Query->Close();
throw Exception("物料编码:'"+m_WsgmGoods+"'已经存在!");
}
//---------------------------------------------------------
//存在性
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("select * from sdGoods Where GoodsType<>1 and GoodsCode='"+m_WsgmGoods+"'");
Query->Open();
if(Query->RecordCount<=0)
{
Query->Close();
throw Exception("物料编码:'"+m_WsgmGoods+"'不存在,或条件不符合!");
}
Query->Close();
}
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmUnit() //计量单位
{
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmFrom() //产品结构表来源
{
int m_WsgmFrom;
m_WsgmFrom=GetMasterValue("WsgmFrom");
if(m_WsgmFrom!=1 && m_WsgmFrom!=2)
throw Exception("工单物料表来源只能取值(1-物料清单,2-工单物料表.)");
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmQty() //消耗定额
{
double m_WsgmQty;
m_WsgmQty=GetMasterValue("WsgmQty");
AnsiString m_WsgmWo;
m_WsgmWo=GetMasterValue("WsgmWo");
if(m_WsgmQty<=0)
throw Exception("消耗定额不能小于等于零!");
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("select WoQty from sdWo where WoCode='"+m_WsgmWo+"'");
Query->Open();
if(Query->RecordCount<1)
{
Query->Close();
throw Exception("工单:"+m_WsgmWo+"不存在");
}
Query->Close();
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmOoq() //领料批量
{
double m_WsgmOoq;
m_WsgmOoq=GetMasterValue("WsgmOoq");
if(m_WsgmOoq<0)
throw Exception("发放批量不能小于零!");
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmPQty() //定额领料量
{
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmShl() //损耗率
{
double m_WsgmShl;
AnsiString m_WsgmWo;
m_WsgmWo=GetMasterValue("WsgmWo");
m_WsgmShl=GetMasterValue("WsgmShl");
if(m_WsgmShl<0 || m_WsgmShl>=1)
throw Exception("损耗率不能小于零,大于和等于1.");
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("select WoQty from sdWo where WoCode='"+m_WsgmWo+"'");
Query->Open();
if(Query->RecordCount<1)
{
Query->Close();
throw Exception("工单:"+m_WsgmWo+"不存在");
}
Query->Close();
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmGQty() //已领量
{
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmLQty() //报废量
{
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmDQty() //损坏量
{
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmRQty() //退料量
{
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmLoc() //货位
{
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmSn() //序号
{
int m_WsgmSn;
int b_WsgmSn;
AnsiString m_WsgmWo;
m_WsgmWo=GetMasterValue("WsgmWo");
m_WsgmSn=GetMasterValue("WsgmSn");
b_WsgmSn=GetMasterOldValue("WsgmSn");
if(m_WsgmSn<0 ||m_WsgmSn==0)
throw Exception("工单配套表的序号不能小于等于零!");
if(m_WsgmSn!=b_WsgmSn)
{
Query->Close();
Query->SQL->Clear();
Query->SQL->Add("select WsgmSn from sdWsgm where WsgmWo='"+m_WsgmWo+"' and WsgmSn="+AnsiString(m_WsgmSn)+"");
Query->Open();
if(Query->RecordCount>0)
{
Query->Close();
throw Exception("工单配套表的序号:'"+AnsiString(m_WsgmSn)+"'已经存在!");
}
Query->Close();
}
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmBatch() //批号
{
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmProcess() //工序
{
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmUQty() //消耗数量
{
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmAQty() //补料数量
{
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmTQty() //换料数量
{
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmClose() //结清
{
int m_WsgmClose;
m_WsgmClose=GetMasterValue("WsgmClose");
if(m_WsgmClose!=0 && m_WsgmClose!=1)
throw Exception("结清标志只能取值(0-未结清,1-结清.)");
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmCloseDate() //结清日期
{
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmUser() //操作员
{
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmStatus() //工单物料表状态
{
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::ValidWsgmSysDate() //系统日期
{
}
//---------------------------------------------------------------------------
void __fastcall TKSWsgm::CmdExec(AnsiString Param)
{
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -