wsz
2025-06-20 19898bd66dec87b500b200d5d50961d0fb538ce5
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
--[[
    编码: WMS-04-04
    名称: 货位-货位信息校正
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: CheckLocAttr
 
    功能:
        -- 把当前容量>=1 并且该货位没有绑定容器的货位表属性 N_CURRENT_NUM 设置为 0
    
    更改记录:
  
--]]
wms_base = require( "wms_base" )
 
function CheckLocAttr ( strLuaDEID ) 
    local   nRet, strRetInfo
 
    local strCondition = "N_CURRENT_NUM >= 1 and S_CODE NOT IN ( select S_LOC_CODE FROM TN_Loc_Container )"
 
    -- 获取货位信息存在问题的货位
    local strOrder = "S_CODE"
    nRet, strRetInfo = mobox.queryDataObjAttr(strLuaDEID, "Location", strCondition, strOrder,"S_CODE" )
    if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "获取【货位】信息失败! " .. strRetInfo) end
    if ( strRetInfo == '' ) then return end
    local location = {}
    local n, nCount
    local success
    local attrs
 
    success, location = pcall( json.decode, strRetInfo)
    if ( success == false ) then lua.Error( strLuaDEID, debug.getinfo(1), "非法的JSON格式!"..warehouse ) end
 
    nCount = #location
    if ( nCount == 0 ) then return end
    -- 组织prompt 信息
    local dirty_loc_code_set = ''
    for n = 1, nCount do
        attrs = location[n].attrs
        dirty_loc_code_set = dirty_loc_code_set..'"'..attrs[1].value..'",'
    end
    if ( dirty_loc_code_set ~= "") then
        mobox.setInfo( strLuaDEID, dirty_loc_code_set )
    end
 
    local strUpdateSql = "N_CURRENT_NUM = 0"
    nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Location", strCondition, strUpdateSql )
    if ( nRet ~= 0 ) then  lua.Error( strLuaDEID, debug.getinfo(1), "更新【货位】信息失败!"..strRetInfo ) end 
end