Jianw
2025-05-14 29f8b36ebb718d2051bf0e7e701973ec4419ee80
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
--[[
    编码: WMS-71-12
    名称: 库存量表差异-新增窗口-确定后
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: AfterClickOk
 
    功能:
          根据输入的仓库、库区编码统计这些仓库、库区的量值
 
    更改记录:
   
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require("oi_base_mobox")
 
function AfterClickOk ( strLuaDEID ) 
    local nRet, strRetInfo
 
    nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "S_WH_CODE", "S_AREA_CODE" ) 
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end 
    local obj_attrs = json.decode( strRetInfo ) 
    local wh_code = obj_attrs[1].value  
    local area_code = obj_attrs[2].value
    local datajson = {}
 
    if ( wh_code == '' ) then
        mobox.setInfo( strLuaDEID, "必须输入仓库编码!" )
        mobox.stopProgram( strLuaDEID, strRetInfo )
        return
    end
 
    datajson.wh_code = wh_code
    datajson.area_code = area_code
 
    local add_wfp_paramter = {}
    add_wfp_paramter.wfp_type = 1                  -- 触发数据类事件
    add_wfp_paramter.cls = "WMS_Inventory_Diff"
    add_wfp_paramter.trigger_event = "库存量表差异检测"
    add_wfp_paramter.datajson = datajson
    nRet, strRetInfo = m3.AddSysWFP( strLuaDEID, add_wfp_paramter )
    if ( nRet ~= 0 ) then
        lua.Error( strLuaDEID, debug.getinfo(1), strRetInfo )
    end
 
    if ( area_code ~= '' ) then 
        local strCondition = "S_AREA_CODE='"..area_code.."'"
        nRet,strRetInfo  = mobox.dbdeleteData( strLuaDEID, "WMS_Inventory_Diff", strCondition )
        if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), strRetInfo ) end 
    else
        if ( wh_code ~= '' ) then  
            local strCondition = "S_WH_CODE='"..wh_code.."'"
            nRet,strRetInfo  = mobox.dbdeleteData( strLuaDEID, "WMS_Inventory_Diff", strCondition )
            if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), strRetInfo ) end
        else
            mobox.setInfo( strLuaDEID, "仓库编码必须有值" )
            return 
        end            
    end    
 
    mobox.setInfo( strLuaDEID, "已经向服务发起货品存储量表检测申请! 请等待.." )
 
end