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
ÿþ--[[
   x: GT-Public-05
    Tðy: !hŒšÂSpe
   \O€ÿLZH
   åegÿ2024-10-11
 
   ýQpeÿ VerifyParam
   ŸRý€:
    10!hŒš YÀhXbpe/f&T/f tepe pe<P{|‹W
    20!hŒšyb!k÷S/f&TX[(W“^X[
    30!hŒšyb!k÷S“^X[/f&Tán³“eQ„v YÀhXbpe
 
   ôf9e°‹U_:
 
--]]
 
json  = require("json")
mobox = require("OILua_JavelinExt")
m3 = require( "oi_base_mobox" )
 
function VerifyParam(strLuaDEID)
    local nRet, strRetInfo
    nRet, strRetInfo = mobox.getCurEditDataObjAttr(strLuaDEID, "S_BATCH_NO", "N_CNTR_QTY")
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖSS_MR‘^\'`1Y%! " .. strRetInfo) end
    lua.Debug(strLuaDEID, debug.getinfo(1), ' YÀhúQ“^nxš[TÂSpe', strRetInfo)
    local obj_attrs = json.decode(strRetInfo)
    local batch_no = obj_attrs[1].value -- yb!k÷S
    local cntr_qty = obj_attrs[2].value --  YÀhXbpe
 
    -- 10!hŒš YÀhXbpe/f&T/f tepe pe<P{|‹W
    if (cntr_qty ~= nil and cntr_qty ~= '') then
        local qty = lua.StrToNumber(cntr_qty)
        if qty < 0 or qty ~= math.floor(qty) then
            mobox.setInfo(strLuaDEID, "÷‹“eQcktepe!")
            return
        end
    end
 
    local strCondition = "S_CNTR_CODE IN (SELECT S_CNTR_CODE FROM TN_CG_Detail WHERE S_BATCH_NO = '" ..
        batch_no .. "')"
 
    -- 20!hŒšyb!k÷S/f&TX[(W“^X[
    if (batch_no ~= nil and batch_no ~= '') then
        nRet, strRetInfo = mobox.getDataObjCount(strLuaDEID, "Loc_Container", strCondition)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), strRetInfo) end
        if (tonumber(strRetInfo) <= 0) then
            mobox.setInfo(strLuaDEID, "yb!k÷S¡l    g“^X[!")
            return
        end
    end
 
    -- 30!hŒšyb!k÷S“^X[/f&Tán³“eQ„v YÀhXbpe
    if (cntr_qty ~= nil and cntr_qty ~= '' and batch_no ~= nil and batch_no ~= '') then
        nRet, strRetInfo = mobox.getDataObjCount(strLuaDEID, "Loc_Container", strCondition)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), strRetInfo) end
        if (tonumber(strRetInfo) < tonumber(cntr_qty)) then
            mobox.setInfo(strLuaDEID, "yb!k÷S„v“^X[ Nán³ YÀhXbpe!")
            return
        end
    end
end