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
68
69
70
--[[
    编码: WMS-05-04
    名称: 逻辑库区-触发存储量重置
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: TrigResetZoneStorage
 
    更改记录:
 
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require("oi_base_mobox")
 
function TrigResetZoneStorage ( strLuaDEID ) 
    local   nRet, strRetInfo
    
    -- 获取当前操作选中的Zone对象
    -- step1  获取输入参数(场景参数)
    nRet, strRetInfo = mobox.getInputParameter2( strLuaDEID ) 
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "获取 WMS-05-04 场景参数失败! "..strRetInfo ) end
    local strDataJson = ''
 
    lua.Debug( strLuaDEID, debug.getinfo(1), "getInputParameter2", strRetInfo )
 
    if ( strRetInfo ~= '' ) then
        local selected_row, success
        success, selected_row = pcall( json.decode, strRetInfo)
        if ( success == false ) then lua.Error( strLuaDEID, debug.getinfo(1), "WMS-05-04 场景参数是非法的JSON格式!"..selected_row ) end
 
        -- 如果是单选
        
        -- 从选中的数据行信息中获取逻辑库区编码
        local nRow, nRowCount
        local n, nCount
        local attrs
        local strZoneCode
 
        nRowCount = #selected_row
        for nRow = 1, nRowCount do 
            attrs = selected_row[nRow].attrs
            strZoneCode = ''
            nCount = #attrs
            for n = 1, nCount do
                if (attrs[n].attr == 'S_CODE') then
                    strZoneCode =  attrs[n].value
                    break
                end
            end
            if (strZoneCode == '') then lua.Error( strLuaDEID, debug.getinfo(1), "Grid中没显示逻辑库区编码字段!" ) end
            strDataJson = strDataJson..'"'..strZoneCode..'",'
        end
        strDataJson = lua.trim_laster_char( strDataJson )
    end
    strDataJson = '['..strDataJson..']'
 
    lua.Debug( strLuaDEID, debug.getinfo(1), "addSysWFP", strDataJson )
 
    -- 加一个后台处理脚本,strDataJson 是这个脚本的输入参数
    nRet, strRetInfo = mobox.addSysWFP( strLuaDEID, 1, strDataJson, "Zone","","", 0, "","存储量重置","存储量重置申请","",0 )
 
    lua.Debug( strLuaDEID, debug.getinfo(1), "addSysWFP.nRet", nRet )
 
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), strRetInfo ) end
 
end