lzh
2025-06-24 13c4a636539584ab977fddacfae884b3ec250aee
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
ÿþ---@diagnostic disable: need-check-nil
--[[
    x: GT-07-11
     Tðy: ÞVŒagîváOo`
    \O€ÿLZH
    åegÿ2024-5-9
 
    §~+RÿúVš[ (ô‹f,gµkãNx(Wy˜îv-N N*YOØSS)
 
    ýQpeÿ CallBackLable
 
    ŸRý€:
        10ÞVŒagîváOo`
    ôf9e°‹U_:
 
--]]
json  = require("json")
mobox = require("OILua_JavelinExt")
m3 = require( "oi_base_mobox" )
wms_base = require( "wms_base" )
function CallBackLable(strLuaDEID)
    local nRet, strRetInfo, attrs, strCondition
    -- ·ƒÖS‘-N„vagxáOo`
    nRet, strRetInfo = mobox.getCurEditDataObjAttr(strLuaDEID, "S_SERIAL_NO")
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖSS_MR‘^\'`1Y%! " .. strRetInfo) end
    attrs = json.decode(strRetInfo)
    local serial_no = attrs[1].value
    if(serial_no == nil or serial_no == '') then return end
 
    --ågâ‹agxáOo`
    strCondition = "S_SERIAL_NO = '" .. serial_no .. "'"
    nRet, strRetInfo = m3.QueryDataObject(strLuaDEID, "GT_Label_Crad", strCondition)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖSagxáOo`1Y%ÿ" .. strRetInfo) end
    if (strRetInfo == '') then lua.Error(strLuaDEID, debug.getinfo(1), "agx NX[(Wÿ") end
 
    local attrs = strRetInfo[1].attrs
    local label_attrs = m3.KeyValueAttrsToObjAttr(attrs)
 
    local action1 = {}
    local setAttr = '[{"attr":"S_VERIFY_CODE","show":false}]'
    action1.action_type = "set_dlg_attr_show"
 
    if (label_attrs.C_IS_VALIDATE == "Y") then
        setAttr = '[{"attr":"S_VERIFY_CODE","show":true}]'
    end
    
    action1.value = json.decode(setAttr)
 
    -- ¾‹n—zãS-N„váOo`
    local setAttr = '[{"attr":"S_ITEM_NAME","value":"' .. label_attrs.S_ITEM_NAME .. '"},'
    setAttr = setAttr .. '{"attr":"S_ITEM_CODE","value":"' .. label_attrs.S_ITEM_CODE .. '"},'
    setAttr = setAttr .. '{"attr":"C_IS_VALIDATE","value":"' .. label_attrs.C_IS_VALIDATE .. '"}]'
    local action = {}
    action.action_type = "set_dlg_attr"
    action.value = json.decode(setAttr)
 
 
    nRet, strRetInfo = mobox.setAction(strLuaDEID, '[' .. lua.table2str(action1) .. "," .. lua.table2str(action) .. ']')
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "setAction1Y%! " .. strRetInfo .. ' action = ' .. strAction) end
end