Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
mAlfh.cpp
Package: 科思ERP部分源码及控件 [view]
Upload User: xgxgxg8
Upload Date: 2007-02-22
Package Size: 6882k
Code Size: 15k
Category:
ERP-EIP-OA-Portal
Development Platform:
Delphi
- //---------------------------------------------------------------------------
- #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-取消");
- AnsiString m_AlfhCancelDate;
- AnsiString b_AlfhCancelDate;
- m_AlfhCancelDate=GetMasterValue("AlfhCancelDate");
- m_AlfhCancel=GetMasterValue("AlfhCancel");
- if(m_AlfhCancel==1)
- {
- if(m_AlfhCancelDate.IsEmpty())
- throw Exception("取消日期不能为空");
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TKSAlfh::ValidItemValues()
- {
- AnsiString m_AlfdCode;
- m_AlfdCode=GetDetailValue("AlfdCode");
- if(m_AlfdCode.IsEmpty())
- throw Exception("调拔单号不能为空!");
- if(m_AlfdCode.Length()>18)
- throw Exception("调拔单号长度不能大于18");
- int m_AlfdLine;
- int b_AlfdLine;
- m_AlfdLine=GetDetailValue("AlfdLine");
- b_AlfdLine=GetDetailOldValue("AlfdLine");
- if(m_AlfdLine<=0)
- throw Exception("调拨单行号不能小于等于零");
- /* if(m_AlfdLine !=b_AlfdLine)
- if(FindKey(AnsiString(m_AlfdLine))) //???????????????????????????
- throw Exception("行号已存在,行号不能重复"); */
- AnsiString m_AlfdOLoc;
- AnsiString b_AlfdOLoc;
- m_AlfdOLoc=GetDetailValue("AlfdOLoc");
- b_AlfdOLoc=GetDetailOldValue("AlfdOLoc");
- AnsiString m_AlfdILoc;
- m_AlfdILoc=GetDetailValue("AlfdILoc");
- if(m_AlfdOLoc.IsEmpty())
- throw Exception("转出货位不能为空");
- if(m_AlfdOLoc.Length()>18)
- throw Exception("转出货位编码长度不能大于18");
- if(m_AlfdOLoc==m_AlfdILoc)
- throw Exception("转出货位不能与转入货位相同");
- if(m_AlfdOLoc!=b_AlfdOLoc)
- {
- Query->Close();
- Query->SQL->Clear();
- Query->SQL->Add("select loccode from sdloc where loccode='"+m_AlfdOLoc+"'");
- Query->Open();
- if(Query->RecordCount<=0)
- {
- Query->Close();
- throw Exception("货位编码:"+m_AlfdOLoc+"未定义");
- }
- Query->Close();
- }
- AnsiString b_AlfdILoc;
- m_AlfdILoc=GetDetailValue("AlfdILoc");
- b_AlfdILoc=GetDetailOldValue("AlfdILoc");
- m_AlfdOLoc=GetDetailValue("AlfdOLoc");
- if(m_AlfdILoc.IsEmpty())
- throw Exception("转入货位不能为空");
- if(m_AlfdILoc.Length()>18)
- throw Exception("转入货位编码长度不能大于18");
- if(m_AlfdILoc==m_AlfdOLoc)
- throw Exception("转入货位不能与转出货位相同");
- if(m_AlfdILoc!=b_AlfdILoc)
- {
- Query->Close();
- Query->SQL->Clear();
- Query->SQL->Add("select loccode from sdloc where loccode='"+m_AlfdILoc+"'");
- Query->Open();
- if(Query->RecordCount<=0)
- {
- Query->Close();
- throw Exception("货位编码:"+m_AlfdILoc+"未定义");
- }
- Query->Close();
- }
- AnsiString m_AlfdGoods;
- AnsiString b_AlfdGoods;
- AnsiString m_AlfdUnit;
- AnsiString m_AlfdConv;
- m_AlfdGoods=GetDetailValue("AlfdGoods");
- b_AlfdGoods=GetDetailOldValue("AlfdGoods");
- m_AlfdOLoc=GetDetailValue("AlfdOLoc");
- m_AlfdILoc=GetDetailValue("AlfdILoc");
- if(m_AlfdOLoc.IsEmpty())
- throw Exception("转出货位不能为空");
- if(m_AlfdILoc.IsEmpty())
- throw Exception("转入货位不能为空");
- if(m_AlfdGoods.IsEmpty())
- throw Exception("物料编码不能为空");
- if(m_AlfdGoods.Length()>18)
- throw Exception("物料编码长度不能大于18");
- if(m_AlfdGoods!=b_AlfdGoods)
- {
- Query->Close();
- Query->SQL->Clear();
- Query->SQL->Add(" select goodscode,goodsunitcode from sdgoods,sdlg where lgstate=1 and goodscode=lggoodscode and ");
- Query->SQL->Add(" goodscode='"+m_AlfdGoods+"' and lgloccode='"+m_AlfdOLoc+"'");
- Query->Open();
- if(Query->RecordCount<=0)
- {
- Query->Close();
- throw Exception("物料编码:"+m_AlfdGoods+"无效,或转出货位:"+m_AlfdOLoc+"未定义该物料");
- }
- Query->Close();
- Query->SQL->Clear();
- Query->SQL->Add(" select goodscode,goodsunitcode from sdgoods,sdlg where lgstate=1 and goodscode=lggoodscode and ");
- Query->SQL->Add(" goodscode='"+m_AlfdGoods+"' and lgloccode='"+m_AlfdILoc+"'");
- Query->Open();
- if(Query->RecordCount<=0)
- {
- Query->Close();
- throw Exception("物料编码:"+m_AlfdGoods+"无效,或转入货位:"+m_AlfdILoc+"未定义该物料");
- }
- m_AlfdUnit=Query->FieldValues["goodsunitcode"];
- m_AlfdConv=1;
- Query->Close();
- }
- AnsiString b_AlfdUnit;
- m_AlfdUnit=GetDetailValue("AlfdUnit");
- b_AlfdUnit=GetDetailOldValue("AlfdUnit");
- m_AlfdGoods=GetDetailValue("AlfdGoods");
- if(m_AlfdGoods.IsEmpty())
- throw Exception("物料编码不能为空");
- if(m_AlfdUnit.IsEmpty())
- throw Exception("计量单位不能为空");
- if(m_AlfdUnit.Length()>18)
- throw Exception("计量单位长度不能大于18");
- Query->Close();
- Query->SQL->Clear();
- if(m_AlfdUnit!=b_AlfdUnit)
- {
- Query->Close();
- Query->SQL->Clear();
- Query->SQL->Add("Select Unitcode from sdUnit where Unitcode='"+m_AlfdUnit+"'");
- Query->Open();
- if(Query->RecordCount<=0)
- {
- Query->Close();
- throw Exception("计量单位:"+m_AlfdUnit+"不存在");
- }
- Query->Close();
- }
- double m_AlfdQty;
- m_AlfdQty=GetDetailValue("AlfdQty");
- if(m_AlfdQty<=0)
- throw Exception("调拨数量必须大于零");
- AnsiString m_AlfdSBatch;
- AnsiString b_AlfdSBatch;
- m_AlfdSBatch=GetDetailValue("AlfdSBatch");
- b_AlfdSBatch=GetDetailOldValue("AlfdSBatch");
- m_AlfdOLoc=GetDetailValue("AlfdOLoc");
- m_AlfdGoods=GetDetailValue("AlfdGoods");
- m_AlfdQty=GetDetailValue("AlfdQty");
- int IsBatch;
- if(m_AlfdGoods.IsEmpty())
- throw Exception("调拔物料不能为空");
- if(m_AlfdSBatch.Length()>18)
- throw Exception("批号编码长度不能大于18");
- Query->Close();
- Query->SQL->Clear();
- Query->SQL->Add("select GoodsBatch from sdgoods where goodscode='"+m_AlfdGoods+"'");
- Query->Open();
- if(Query->RecordCount<=0)
- {
- Query->Close();
- throw Exception("调拔物料不存在");
- }
- else
- {
- IsBatch=Query->FieldValues["GoodsBatch"];
- Query->Close();
- }
- if(IsBatch==0)
- {
- if(!m_AlfdSBatch.IsEmpty())
- throw Exception("物料:"+m_AlfdGoods+" 不需批次管理");
- }
- if(IsBatch==1&&m_AlfdSBatch.IsEmpty())
- {
- throw Exception("物料:"+m_AlfdGoods+" 需批次管理,必须填上调出批号");
- }
- if(m_AlfdSBatch.IsEmpty()==false && m_AlfdSBatch!=b_AlfdSBatch)
- {
- AnsiString BatchSSql;
- AnsiString CurFmonth;
- // CurFmonth=GetCurMonth();
- // AnsiString CurFmonth;
- Query->Close();
- Query->SQL->Clear();
- Query->SQL->Add("select CSCMMONTH from sdcscm where CSCMClASSID='Inventory'");
- Query->Open();
- CurFmonth=Query->FieldValues["CSCMMONTH"];
- Query->Close();
- Query->SQL->Clear();
- // m_Query->SQL->Add("select Batchcode from sdBatch where Batchcode='"+value+"'");
- BatchSSql="select BthtAoyQty from sdBtht where BthtBatch='"+m_AlfdSBatch+"' and BthtFmonth='"+CurFmonth+"' and BthtLoc='"+m_AlfdOLoc+"' and BthtGoods='"+Trim(m_AlfdGoods)+"'";
- Query->SQL->Add(BatchSSql);
- Query->Open();
- if(Query->RecordCount<=0)
- {
- Query->Close();
- throw Exception("批号编码:"+m_AlfdSBatch+"未定义");
- }
- double FQty;
- FQty=Query->FieldValues["BthtAoyQty"];
- if (FQty<m_AlfdQty)
- {
- Query->Close();
- throw Exception("转出货位物料的批次数量不够");
- }
- Query->Close();
- }
- AnsiString m_AlfdDesc;
- m_AlfdDesc=GetDetailValue("AlfdDesc");
- if(m_AlfdDesc.Length()>40)
- throw Exception("备注长度不能大于40");
- }
- //---------------------------------------------------------------------------
- void __fastcall TKSAlfh::CmdExec(AnsiString Param)
- {
- }
- //---------------------------------------------------------------------------