技术1:当天pshaucdocno为空添加APS-APS-19070400001,不为空APS-APS-19070400002一次累加
DEFINE ls_docno like pshauc_t.pshaucdocno #定义 ls_docno
CALL s_transaction_begin()
select to_char(g_master.date1,'yyyymmdd') into l_date2 from dual # g_master.date1批处理参数
error l_date2
select SUBSTR(l_date2,3,6) into l_date3 from dual # 取20190704中190704
error l_date3
SELECT to_number(substr(MAX(pshaucdocno),15,5))+1 #如果不为空+1
into li_num
from pshauc_t where to_char(pshaucdocdt,'yyyymmdd') = l_date2
and pshaucent = g_enterprise #取最大pshaucdocno
# error to_char(g_master.date1,'yyyymmdd')
error li_num
if cl_null(li_num) then
# LET ls_docno = g_enterprise +'-APS-'+ '190621'+ '00001'
LET ls_docno = g_site ,'-APS-',l_date3,'00001' #如果为空直接定义00001
error ls_docno
END IF
If NOT cl_null(li_num) THEN
select trim(to_char(li_num,'00000')) INTO l_tmp from dual
error l_tmp
let ls_docno = g_site||'-APS-'||l_date3||l_tmp
error ls_docno
end if