1
Jianw
9 天以前 70f29da38121b9a467841253e3268feb5df02902
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
--[[
   编码: AMS-24-25
   名称: 
   作者:
   日期:2025-05-09
 
   函数: AfterSubmit
   功能:
 
   更改记录:
 
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require ("oi_base_mobox")
 
function AfterSubmit( strLuaDEID )
 
    local nRet, strRetInfo
    local data_json, obj_attrs
    nRet, data_json = m3.GetSysDataJson( strLuaDEID )
    if ( nRet ~=0 ) then 
        lua.Error( strLuaDEID, debug.getinfo(1), data_json ) 
    end  
    
    local nCount = #data_json
    if ( nCount == 0 ) then  
        return 
    end
    lua.Debug(strLuaDEID, debug.getinfo(1), "data_json", data_json)
    local obj_attrs
    local state 
    local err = {}
    local strCondition, strSetAttr
    for n = 1, #data_json do
        obj_attrs = m3.KeyValueAttrsToObjAttr( data_json[n].attrs )
        state = obj_attrs.S_STATE
        if ( state == '新建' ) then
            strCondition = "S_NO = '"..obj_attrs.S_NO.."'"
            strSetAttr = "S_STATE = '审核'"
            nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Outbound_Order", strCondition, strSetAttr )
            if ( nRet ~= 0 ) then 
                lua.Error( strLuaDEID, debug.getinfo(1), "更新数据失败: "..strRetInfo) 
            end
        else
            table.insert( err, obj_attrs.S_NO )
        end
        
    end
    
    if ( #err > 0 ) then
        local err_msg = "单据状态不为编辑,不能审核!" .. table.concat( err, "," )
        mobox.setInfo( strLuaDEID, err_msg )
    end
    
 
    local action = {
        {
            action_type = "refresh",
            value = ""
        }
    }
    nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str( action ))
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction错误: "..strRetInfo) end          
 
end