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
--[[
   编码: AMS-21-25
   名称: 
   作者:
   日期:2025-04-27
 
   函数: ItemCodeChange
   功能:
 
   更改记录:
 
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require ("oi_base_mobox")
 
function ItemCodeChange( strLuaDEID )
    local nRet, strRetInfo
    local cntr_detail_array
    
    local nRet,whcode
    nRet,whcode = wms_base.Get_sConst2("人工库存储区" )
    if ( nRet ~= 0 ) then
        lua.Error(strLuaDEID, debug.getinfo(1), "获取系统常量:人工库存储区失败!" )
    end
    
    -- 获取当前编辑的容器编码
    nRet, strRetInfo = mobox.getCurEditDataObjAttr(strLuaDEID, "S_IO_NO")
    if (nRet ~= 0) then
        lua.Error(strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo)
    end
 
    local obj_attrs = json.decode(strRetInfo)
    local io_no = lua.Get_StrAttrValue(obj_attrs[1].value)
    
    local strCondition = "S_NO = '" .. io_no .. "'"
    nRet, strRetInfo = m3.GetDataObjByCondition(strLuaDEID, "Inbound_Order", strCondition)
    if (nRet ~= 0) then 
        mobox.setInfo(strLuaDEID, "查询 Inbound_Order 表失败: " .. strRetInfo) 
        return
    end
    lua.Debug(strLuaDEID, debug.getinfo(1), "入库单信息-->", strRetInfo)
    
    local area_code = strRetInfo.area_code      --校验库区值
    if(area_code ~= whcode)then
        mobox.setInfo(strLuaDEID, "编码 = '" .. io_no .. "'的入库单的库区值不符合人工库!!!")
        return
    end
    
    local bs_state = strRetInfo.b_state     -- 校验状态值
    if(bs_state == 3) then
        mobox.setInfo(strLuaDEID, "编码 = '" .. io_no .. "'的入库单已经完成!!!")
        return
    end
    
end