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
61
62
63
64
65
66
67
68
69
70
71
72
ÿþ--[[
    x: GT-05-10
     Tðy: Am4l÷S“eQØSôfT
    \O€ÿLZH
    åegÿ2024-5-7
 
    §~+RÿúVš[ (ô‹f,gµkãNx(Wy˜îv-N N*YOØSS)
 
    ýQpeÿ CallBack
 
    ŸRý€:
        10ÞVŒ—zãSáOo`
 
    ôf9e°‹U_:
        V2.0 HAN 2024/5/10 ÖSˆm·ƒÖSå]MOI{áOo` ÿُ›N(WRËYS„vöeP1\ò]Ï~Œ[b
        V2.1 LZH 2024/8/9 penc!j‹WØS¨RŒte
        V2.2 LZH 2025/1/10 $R­e8^ϑ sO-ň±{!hŒš_sQ/f&T_/T _/TR¥b•Ðc:y ÿ*g_/TR$R­eAm4l÷S/f&TÑ~š[¹[hV
 
--]]
json  = require("json")
mobox = require("OILua_JavelinExt")
m3 = require( "oi_base_mobox" )
 
function CallBack(strLuaDEID)
    local nRet, strRetInfo,str
 
    -- ·ƒÖS¥cãS-N„vDatapenc
    nRet, strRetInfo = mobox.getCurEditDataObjAttr(strLuaDEID, "S_SERIAL_NO", "S_STATION")
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "Œ(u¹eÕlGetSysDataJsonúQ•") end
    local obj_attrs = json.decode(strRetInfo)
 
    -- PDAkbx„vAm4l÷S
    local serial_no = obj_attrs[1].value
    if (serial_no == nil or serial_no == '') then return end
 
    -- V2.2 $R­eň±{!hŒš_sQ/f&T_/T,*g_/TRÐc:y
    strRetInfo = wms_base.Get_sConst(strLuaDEID, "sO-ň±{!hŒš_sQ")
    if(strRetInfo == 'N')then
        mobox.setInfo(strLuaDEID,"ň±{!hŒšŸRý€*g_/T!")
        return
    end
 
    -- V2.2 $R­eAm4l÷S/f&TÑ~š[¹[hV,Ñ~š[R¥b•
    local strCondition = "S_SERIAL_NO = '" .. serial_no .. "'"
    nRet, str = m3.GetDataObjByCondition(strLuaDEID, "CG_Detail", strCondition)
    if (nRet == 2) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖS¹[hV'ÁTfÆ~1Y%!" .. str) end
    if (nRet == 0 and str ~= nil and str ~= '') then
        mobox.setInfo(strLuaDEID,"Am4l÷Sò]Ñ~š[¹[hV!")
        return
    end
 
    --9hncAm4l÷S·ƒÖSîvƉaSáOo`
    strCondition = "S_SERIAL_NO = '" .. serial_no .. "'"
    nRet, strRetInfo = m3.GetDataObjByCondition(strLuaDEID, "GT_Label_Crad", strCondition)
    if (nRet == 1) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖSeQ“^USncLˆ1Y%!" .. strRetInfo) end
 
    -- ¾‹n—zãS-N„v Åˆ±{!hŒšáOo`
    local value = {}
    value[1] = lua.KeyValueObj("S_DELIVERY_NO", strRetInfo.delivery_no)
    value[2] = lua.KeyValueObj("S_DELIVERY_ROW_NO", strRetInfo.delivery_row_no)
    value[4] = lua.KeyValueObj("S_ITEM_CODE", strRetInfo.item_code)
    value[5] = lua.KeyValueObj("S_ITEM_NAME", strRetInfo.item_name)
 
    local action = {}
    action.action_type = "set_dlg_attr"
    action.value = value
 
    lua.Debug(strLuaDEID, debug.getinfo(1), 'action', '[' .. lua.table2str(action) .. ']')
    nRet, strRetInfo = mobox.setAction(strLuaDEID, '[' .. lua.table2str(action) .. ']')
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "setAction1Y%! " .. strRetInfo) end
    lua.Debug(strLuaDEID, debug.getinfo(1), "action", action)
end