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
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by HUI.
--- DateTime: 2024/3/7 13:53
---
 
require("WMS-BASE")
require("oi_basestrfunc")
 
function AfterInputItemName (strLuaDEID)
 
    local attrs, nRet, strRetInfo, Material
 
    -- 获取输入的物料名称
    nRet, attrs = GetSysInputParameter(strLuaDEID)
    if (nRet ~= 0) then
        Error(strLuaDEID, debug.getinfo(1), "获取当前输入面板里的属性失败! " .. attrs)
    end
 
    local resData = KeyValueAttrsToObjAttr(attrs)
    local ItemName = resData.S_ITEM_NAME
 
    -- 查询【物料表】
    local strCondition = "S_ITEM_NAME = '" .. ItemName .. "'"
    local strOrder = "T_CREATE"
    nRet, Material = QueryDataObject(strLuaDEID, "Material", strCondition, strOrder)
    if (nRet ~= 0) then
        Error(strLuaDEID, debug.getinfo(1), "获取【容器货品明细】信息失败! " .. Material)
    end
 
    Debug(strLuaDEID, debug.getinfo(1), "查询到的物料信息:", Material)
 
    -- 设置《待入库》页面信息
    local strDataJson, strAction
    if (#Material == 0) then
        strDataJson = '{"page_name":"待入库","clear":true,"content":[]}'
    else
        strDataJson = '{"page_name":"待入库","clear":true,"content":' .. table2str(Material) .. '}'
    end
    strAction = '[{"action_type":"set_subtable_page_content","value":' .. strDataJson .. '}]'
 
    Debug(strLuaDEID, debug.getinfo(1), "strAction:", strAction)
 
    nRet, strRetInfo = mobox.setAction(strLuaDEID, strAction)
    if (nRet ~= 0) then
        Error(strLuaDEID, debug.getinfo(1), "setAction失败! " .. strRetInfo .. ' action = ' .. strAction)
    end
 
end