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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
--[[
   编码: AMS-101-11
   名称: 料箱编码变化后
   作者:LZH
   日期:2025-05-14
 
   函数: AfterCntrCodeInput
   功能:
 
   更改记录:
 
--]]
 
json  = require("json")
mobox = require("OILua_JavelinExt")
m3    = require("oi_base_mobox")
 
function AfterCntrCodeInput(strLuaDEID)
    local nRet, strRetInfo
    local cntr_detail_array
    local attrs
 
    nRet, attrs = m3.GetSysInputParameter(strLuaDEID)
    if (nRet ~= 0) then
        mobox.setInfo(strLuaDEID, "获取当前输入面板里的属性失败! " .. attrs)
        return
    end
    -- lua.Debug(strLuaDEID, debug.getinfo(1), "attrs", attrs)
 
    local input_attr = m3.KeyValueAttrsToObjAttr(attrs)
    local cntr_code = input_attr.S_CNTR_CODE -- 料箱编码
 
    if (cntr_code == nil or cntr_code == '') then
        mobox.setInfo(strLuaDEID, "料箱编码不能为空!")
        return
    end
 
    -- 查询安全库存明细
    nRet, cntr_detail_array = m3.QueryDataObject(strLuaDEID, "SAF_Inventory", "S_CNTR_CODE = '" .. cntr_code .. "'")
    if (nRet ~= 0) then
        mobox.setInfo(strLuaDEID, "获取【安全库存量表】信息失败!" .. cntr_detail_array)
        return
    end
    lua.Debug(strLuaDEID, debug.getinfo(1), "cntr_detail_array", cntr_detail_array)
 
    local action_array = {}
    -- 如果有该料箱的安全库存记录则显示在已码盘页面
    if (#cntr_detail_array > 0) then
        -- local date_list = m3.KeyValueAttrsToObjAttr(cntr_detail_array[1].attrs)
 
        action_array[1] = {
            action_type = "set_subtable_page_content",
            value = {
                page_name = "已码盘",
                content = cntr_detail_array,
                clear = true,
                clear_confirm = false,
                checkbox = false
            }
        }
 
        -- 将光标放在货位编码框
        action_array[2] = {
            action_type = "set_dlg_current_edit_attr",
            value = "S_LOC_CODE"
        }
        lua.Debug(strLuaDEID, debug.getinfo(1), "action_array", action_array)
        nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action_array))
        if (nRet ~= 0) then
            mobox.setInfo(strLuaDEID, "setAction失败! " .. strRetInfo)
            return
        end
    else
        -- 将光标放在货位编码框
        action_array[1] = {
            action_type = "set_dlg_current_edit_attr",
            value = "S_LOC_CODE"
        }
        lua.Debug(strLuaDEID, debug.getinfo(1), "action_array", action_array)
        nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action_array))
        if (nRet ~= 0) then
            mobox.setInfo(strLuaDEID, "setAction失败! " .. strRetInfo)
            return
        end
    end
end