1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
| --[[
| 编码: WMS-55-01
| 名称: 采购订单-创建前
| 作者:HAN
| 日期:2025-1-29
|
| 级别:固定 (说明本段代码在项目中不太会变化)
|
| 函数: BeforeDataObjCreate
|
| 功能:
| 1)如果采购单号为空自己生成一个编码
| 变更记录:
| V6.0 HAN 2023/9/6 -- lua.Error/lua.Debug 函数变化
| --]]
| json = require ("json")
| mobox = require ("OILua_JavelinExt")
| m3 = require("oi_base_mobox")
|
| function BeforeDataObjCreate ( strLuaDEID )
| local nRet, strRetInfo
| local strNo = ''
|
| nRet, strNo = m3.GetSysCurEditDataOneAttr( strLuaDEID, "S_NO" )
| if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "GetSysCurEditDataOneAttr失败! "..strNo ) end
| if ( strNo == '') then
| -- 生成采购单编码
| local strCode = ''
| local strHead = 'PO'..os.date("%y%m")..'-'
| nRet,strCode = mobox.getSerialNumber( "采购订单", strHead, 4 )
| if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), '申请【采购订单】编码失败!'..strCode ) end
|
| -- 设置信息
| local attr_value = {}
| attr_value[1] = lua.KeyValueObj( "S_NO", strCode )
| nRet, strRetInfo = mobox.setCurEditDataObjAttr( strLuaDEID, lua.table2str(attr_value) )
| if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "设置【采购订单】信息失败! "..strRetInfo ) end
| end
| end
|
|