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
ÿþ--[[
    x: GT-17-01
     Tðy: Rú^MR
    \O€ÿLZH
    åegÿ2024-8-1
 
    §~+RÿúVš[ (ô‹f,gµkãNx(Wy˜îv-N N*YOØSS)
 
    ýQpeÿ BeforeDataObjCreate
 
    ŸRý€:
        1    ÿ·ƒÖSÂSpeS_TYPE,S_SUB_TYPE,S_MINOR_TYPE
        2    ÿ!hŒš ÿ T7h„vS_TYPE,S_SUB_TYPE,S_MINOR_TYPEêSý€    gNag
        3    ÿ!hŒš ÿS_MINOR_TYPE Nô~¤b„vÅ`µQ N T7h„vS_TYPE,S_SUB_TYPEêSý€    gNag
    ôf9e°‹U_:
--]]
 
require("WMS-BASE")
 
function BeforeDataObjCreate(strLuaDEID)
    local nRet, strRetInfo
    -- step1  ·ƒÖSÂSpeS_TYPE,S_SUB_TYPE,S_MINOR_TYPE
    nRet, strRetInfo = mobox.getCurEditDataObjAttr(strLuaDEID, "S_TYPE", "S_SUB_TYPE", "S_MINOR_TYPE")
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖSS_MR‘^\'`1Y%! " .. strRetInfo) end
    lua.Debug(strLuaDEID, debug.getinfo(1), ' OÂSstrRetInfo!', strRetInfo)
    local obj_attrs = json.decode(strRetInfo)
    local type = obj_attrs[1].value       -- {|‹W
    local sub_type = obj_attrs[2].value   -- -N{|
    local minor_type = obj_attrs[3].value -- \{|
 
    if (type == '') then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖSir™e{|‹W1Y%! ") end
    if (sub_type == '') then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖS-N{|1Y%! ") end
 
    local strCondition
    if (minor_type == nil or minor_type == '') then
        -- step3 !hŒšS_MINOR_TYPE Nô~¤b„vÅ`µQ N T7h„vS_TYPE,S_SUB_TYPEêSý€    gNag
        strCondition = "S_TYPE = '" .. type .. "' AND S_SUB_TYPE = '" .. sub_type .. "' AND S_MINOR_TYPE IS NULL"
        nRet, strRetInfo = mobox.getDataObjCount(strLuaDEID, "GT_ITEM_TYPE", strCondition)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "getDataObjCount1Y%!" .. strRetInfo) end
        lua.Debug(strLuaDEID, debug.getinfo(1), '{|‹W-N{|ýøv T„vpeϑ!', strRetInfo)
        if (tonumber(strRetInfo) > 0) then
            lua.Error(strLuaDEID, debug.getinfo(1), "\{|*gô~¤b„vÅ`µQ Nò]X[(WNagir™e^\'`0-N{|ýøv T„vpenc!")
        end
    else
        -- step2 !hŒš T7h„vS_TYPE,S_SUB_TYPE,S_MINOR_TYPEêSý€    gNag
        strCondition = "S_TYPE = '" ..
            type .. "' AND S_SUB_TYPE = '" .. sub_type .. "' AND S_MINOR_TYPE = '" .. minor_type .. "'"
        nRet, strRetInfo = mobox.getDataObjCount(strLuaDEID, "GT_ITEM_TYPE", strCondition)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "getDataObjCount1Y%!" .. strRetInfo) end
        lua.Debug(strLuaDEID, debug.getinfo(1), '{|‹W-N\{|ýøv T„vpeϑ!', strRetInfo)
        if (tonumber(strRetInfo) > 0) then
            lua.Error(strLuaDEID, debug.getinfo(1), "ò]X[(WNagir™e^\'`0-N{|0\{|ýøv T„vpenc!")
        end
    end
end