1
Jianw
2025-07-09 f6f5e6b632d6649386a380558d84003f3de7ec6c
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
87
--[[
    编码: GK-56-13
    来源: WMS-56-13
    名称: 预分配容器明细-组盘输入-初始化
    作者:HAN  
    日期:2025-6-25
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: InitialDlg
 
    功能:
        -- 根据 panel 里的参数设置 自定义表单 中的属性
 
    更改记录:
 
--]]
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require("oi_base_mobox")
 
function InitialDlg ( strLuaDEID ) 
    local nRet, strRetInfo
    local runtime_parameter
 
    nRet, runtime_parameter = m3.GetRuntimeParam(strLuaDEID)
    if ( nRet ~= 0 ) then 
        lua.Stop( strLuaDEID, "GetRuntimeParam失败! "..runtime_parameter ) 
        return
    end
    -- 获取【料格显示】面板的参数
    local parameter
    nRet, parameter = m3.GetRuntimePanel_InputParamter( strLuaDEID, runtime_parameter.panel, "组盘输入" )
    if ( nRet == 1 ) then 
        mobox.setInfo( strLuaDEID, debug.getinfo(1), "没有定义'组盘输入'面板参数!")
        return 
    end
    if ( nRet ~= 0 ) then 
        lua.Stop( strLuaDEID, parameter ) 
        return
    end 
    if ( parameter == nil ) then return end    
 
    local action = {}
    if parameter.id == '' then
        -- 清空
        action =  {
            {
                action_type = "set_dlg_attr",
                value = {
                    { attr = "TrayCode", value = "" },
                    { attr = "Prompt", value = "请扫周转箱号" },
                    { attr = "BarCode", prompt = "请扫周转箱号" },
                    { attr = "S_ITEM_CODE", value = "" },
                    { attr = "S_ITEM_NAME", value = "" },
                    { attr = "S_BATCH_NO", value = "" },
                    { attr = "F_QTY", value = ""},
                    { attr = "ScanType", value = '批次条码' },
                    { attr = "F_ACT_QTY", value = ""  }
                }
            }
        }        
    else
        action =  {
            {
                action_type = "set_dlg_attr",
                value = {
                    { attr = "S_ITEM_CODE", value = parameter.item_code },
                    { attr = "S_ITEM_NAME", value = parameter.item_name },
                    { attr = "S_BATCH_NO", value = parameter.batch_no },
                    { attr = "F_QTY", value = parameter.qty },
                    { attr = "SN", value = ''},
                    { attr = "ScanType", value = '批次条码'  },
                    { attr = "F_ACT_QTY", value = 0, enable = false  }
                }
            }
    
        }
    end
 
    nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action)  )
    if ( nRet ~= 0 ) then 
        lua.Stop( strLuaDEID, "setAction失败! "..strRetInfo )
        return
    end 
 
end