1
Jianw
2025-07-09 f6f5e6b632d6649386a380558d84003f3de7ec6c
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
--[[
   编码: WMS-26-11
   名称: 
   作者:
   日期:2025-07-03
 
   函数: BeforeDataObjModify
   功能:
 
   更改记录:
 
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require ("oi_base_mobox")
 
function BeforeDataObjModify( strLuaDEID )
    local nRet, strRetInfo
    nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "N_CUR_OP_TYPE","S_CODE","S_LOC_CODE" ) 
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end 
    local obj_attrs = json.decode( strRetInfo ) 
    local op_type = obj_attrs[1].value
    local code = obj_attrs[2].value
    local loc_code = obj_attrs[3].value
    
    lua.Debug(strLuaDEID, debug.getinfo(1), "获取当前模式 -->", op_type)
    lua.Debug(strLuaDEID, debug.getinfo(1), "获取当前站台号 -->", loc_code)
    
    strCondition = "S_END_LOC = '"..loc_code.."' AND N_B_STATE IN (0,1,5,6,8)"
    nRet, strRetInfo = mobox.getDataObjCount( strLuaDEID, "Operation", strCondition )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "getDataObjCount失败!"..strRetInfo ) end
    task_num = lua.StrToNumber( strRetInfo )
    if(task_num > 0) then
        lua.Stop(strLuaDEID, "当前站台有执行的任务不可作业!")
        return
    end
 
end