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
--[[
   编码: AMS-21-27
   名称: 
   作者:
   日期:2025-04-28
 
   函数: LocationChange
   功能:
 
   更改记录:
 
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require ("oi_base_mobox")
wms_wh = require( "wms_wh" )
 
function LocationChange( strLuaDEID )
    local nRet ,attrs
    local loc
    
    -- 获取表头界面中的输入条码
    nRet, attrs = m3.GetSysInputParameter(strLuaDEID)
    if (nRet ~= 0) then
        mobox.setInfo(strLuaDEID,  "获取当前输入面板里的属性失败! " .. attrs)
        return
    end
    
    local input_attr = m3.KeyValueAttrsToObjAttr(attrs)
    local io_no = input_attr.S_IO_NO                        -- 入库单号
    local item_code = input_attr.S_ITEM_CODE                -- 物料编码
    local code = input_attr.S_EXT_ATTR1                     -- 原货位
    local loc_code = input_attr.S_EXT_ATTR2                 -- 货位编码
 
    nRet, loc = wms_wh.GetLocInfo( loc_code )
    if ( nRet ~= 0 ) then
        mobox.setInfo(strLuaDEID, "货位'"..loc_code.."'不存在!" )
        return
    end
    if (loc.lock_state ~= 0) then
        mobox.setInfo(strLuaDEID, "货位'" ..loc.. "'有锁,不可操作!")
        return        
    end
    if (loc.area_code ~= "rg") then
        mobox.setInfo(strLuaDEID, "货位'" ..loc.. "'非人工库,不可操作!")
        return        
    end
    -- 正在码盘和已码盘页面
    local obj
    nRet, obj = m3.GetSysDataJson(strLuaDEID) 
    if (nRet ~= 0) then
        mobox.setInfo(strLuaDEID, "无法获取数据包! " .. obj)
        return
    end
    lua.Debug(strLuaDEID, debug.getinfo(1), "obj", obj)
 
    local item_list_sorting = obj[1].item_list
    local attrs_obj = m3.KeyValueAttrsToObjAttr(item_list_sorting[1].attrs)
 
    local f_qty = lua.Get_NumAttrValue(attrs_obj.F_QTY)
    local acc_i_qty = lua.Get_NumAttrValue(attrs_obj.F_ACC_I_QTY)
    local qty = lua.Get_NumAttrValue(attrs_obj.Qty)
    local act_qty = acc_i_qty + qty
    if (act_qty > f_qty ) then
        mobox.setInfo(strLuaDEID, "物料'" ..item_code.. "'的数量大于入库单的数量!")
        return
    end
    
 
 
 
end