有时候上传数据到Infor ERP LN 系统的时候,需要写一段说明放在Session上面,备注一下相关的上传格式,每一次都写Label的话有点麻烦,于是用自定义一个相对长的字符串参数,显示到Session。
extern domain tcmcs.str80 f.format
before.program: f.format = "Format:BP,Agency,Item Group,S B Appli.(1=Y,2=N),Country,State,S Zip, E Zip,Rate"
好了,回到正题,以下函数会有经常在上传前进行数据校验:
function domain tcbool valid.bp(domain tccom.bpid tmp.bpid)
{
select tccom100.bpid
from tccom100
where tccom100.bpid = {:tmp.bpid}
selectdo
return(true)
endselect
return(false)
}
function domain tcbool valid.agency(domain tccitg tmp.agen)
{
if (tmp.agen="") then
return(true)
endif
select tdwai079.agen
from tdwai079
where tdwai079.agen = {:tmp.agen}
selectdo
return(true)
endselect
return(false)
}
function domain tcbool valid.item.group(domain tccitg tmp.citg)
{
select tcmcs023.citg
from tcmcs023
where tcmcs023.citg = {:tmp.citg}
selectdo
return(true)
endselect
return(false)
}
function domain tcbool valid.country(domain tcccty tmp.ccty)
{
if (tmp.ccty="") then
return(true)
endif
select tcmcs010.ccty
from tcmcs010
where tcmcs010.ccty = {:tmp.ccty}
selectdo
return(true)
endselect
return(false)
}
function domain tcbool valid.state(domain tcccty tmp.ccty, domain tcmcs.cste tmp.cste)
{
if (tmp.ccty="") then
return(true)
endif
if (tmp.cste="") then
return(true)
endif
select tcmcs143.cste
from tcmcs143
where tcmcs143.ccty = {:tmp.ccty}
and tcmcs143.cste = {:tmp.cste}
selectdo
return(true)
endselect
return(false)
}
function domain tcbool valid.item(domain tcitem tmp.item)
{
select tcibd001.item
from tcibd001
where tcibd001._index1 = {:tmp.item}
selectdo
return(true)
endselect
return(false)
}
function domain tcbool valid.cwar(domain tccwar temp.cwar)
{
select tcmcs003.*
from tcmcs003
where tcmcs003._index1 = {:temp.cwar}
selectdo
return(true)
endselect
return(false)
}
function domain tcbool valid.loca(domain tccwar temp.cwar, domain whloca temp.loca)
{
select whwmd300.loca
from whwmd300
where whwmd300._index1 = {:temp.cwar,:temp.loca}
selectdo
return(true)
endselect
return(false)
}