fy36
2025-05-14 a37aca60ff9914b0abb710f04118b22420f4f398
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
--[[
    编码: WMS-25-22
    名称: 入库单明细-新增小窗口-选物料后
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: AfterSelectItem
 
    功能:
        在货品查询面板中选中一个货品后
 
    更改记录:
 
--]]
 
wms_base = require ("wms_base")
 
function AfterSelectItem ( strLuaDEID )
    local nRet, strRetInfo, select_dataobj
 
    local data_json
    nRet, data_json = m3.GetSysDataJson( strLuaDEID )
    if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), data_json ) end
    local nCount = #data_json
    if ( 0 == nCount ) then
        mobox.setInfo( strLuaDEID, "请先选中一个商品!" )
        return
    end
    local obj_attrs = m3.KeyValueAttrsToObjAttr( data_json[1].attrs )
 
    local item_code = obj_attrs.S_ITEM_CODE
    local item_name = obj_attrs.S_ITEM_NAME
    local weight = lua.StrToNumber( obj_attrs.F_WEIGHT )
    local volume = lua.StrToNumber( obj_attrs.F_VOLUME )
 
    if ( volume == 0 ) then 
        lua.Error( strLuaDEID, debug.getinfo(1), "选中的物料体积为0! " ) 
    end
 
    local action = {
            {
                action_type = "set_dlg_attr",
                value = {
                            { attr = "S_ITEM_CODE", value = item_code },
                            { attr = "S_ITEM_NAME", value = item_name },
                            { attr = "F_VOLUME", value = volume },
                            { attr = "F_WEIGHT", value = weight }
                        }
            }
        }
   
    nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action)  )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end     
end