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
ÿþ--[[
   x: GT-122-22
    Tðy:
   \O€ÿ
   åegÿ2025-02-24
 
   ýQpeÿ CallBackMaterial
   ŸRý€:
 
   ôf9e°‹U_:
 
--]]
 
json  = require("json")
mobox = require("OILua_JavelinExt")
m3    = require("oi_base_mobox")
 
function CallBackMaterial(strLuaDEID)
    -- ·ƒÖS    -N„vpencù[aŒ
    local nRet, obj = m3.GetSysDataJson(strLuaDEID)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), obj) end
    local name = obj[1].name
 
    -- W[&{2NRrR
    local str = lua.split(name, "&")
 
    -- ·ƒÖS!hŒš„v'MO
    local loc_container
    local condition = "S_CNTR_CODE IN (SELECT S_CNTR_CODE FROM TN_CG_Detail WHERE S_BATCH_NO = '"..str[3].."' ) AND S_LOC_CODE IN (SELECT S_CODE FROM TN_Location where S_AREA_CODE IN('LZB','TH','FC'))"
    local order_by = "S_LOC_CODE"
    nRet, loc_container = m3.GetDataObjByCondition(strLuaDEID, "Loc_Container", condition,order_by)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "m3.GetDataObjByCondition 1Y%!" .. loc_container) end
 
 
    -- ÞVŒ¾‹n—zãSáOo`
    local setAttr = '[{"attr":"S_ITEM_CODE","value":"' .. str[1] .. '"},'
    setAttr = setAttr .. '{"attr":"S_ITEM_NAME","value":"' .. str[2] .. '"},'
    setAttr = setAttr .. '{"attr":"S_LOC_CODE","value":"' .. loc_container.loc_code .. '"},'
    setAttr = setAttr .. '{"attr":"S_BATCH_NO","value":"' .. str[3] .. '"}]'
    local action = {}
    action.action_type = "set_dlg_attr"
    action.value = json.decode(setAttr)
    local strRetInfo
    nRet, strRetInfo = mobox.setAction(strLuaDEID, '[' .. lua.table2str(action) .. ']')
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "setAction1Y%! " .. strRetInfo) end
end