Jianw
2025-05-13 3b39fe3810c3ee2ec9ec97236c1769c5c85e062c
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
--[[
    编码: JX-35-11
    名称: 指定出库容器明细-3055 TOP-VIEW 容器输入变化
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: AfterCNTRChange
 
    功能:
        -- 根据输入的容器号,判断在当前工作台是否有该容器号的  【指定出库容器明细】 ,有显示在 当前任务 页签
        -- 如果当前到站台的入库任务中的容器号和扫码输入的容器号不相等报错
    更改记录:
 
--]]
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require("oi_base_mobox")
 
function AfterCNTRChange ( strLuaDEID ) 
    local nRet, strRetInfo
 
    -- 获取站台编码
    nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "S_STATION_NO","S_CNTR_CODE" ) 
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end 
    local obj_attrs = json.decode( strRetInfo ) 
    local station = lua.Get_StrAttrValue( obj_attrs[1].value )  
    local cntr_code = lua.Get_StrAttrValue( obj_attrs[2].value )  
    
    if ( station == '' or cntr_code == '' ) then return end
 
    -- 判断 容器 是否已经搬运到入库站台
    --   Specify_Outbound_CNTR 中的 N_B_STATE = 2
    local strCondition = "S_STATION_NO = '"..station.."' AND N_B_STATE = 2 AND S_CNTR_CODE = '"..cntr_code.."'"
    nRet, strRetInfo = mobox.existThisData( strLuaDEID, "Specify_Outbound_CNTR", strCondition )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), strRetInfo )  end
    if ( strRetInfo ~= "yes" ) then 
        mobox.setInfo( strLuaDEID, "指定出库料箱'"..cntr_code.."'还没有到达站台"..station)
        return 
    end
 
    strCondition = "S_STATION_NO = '"..station.."' AND N_B_STATE = 1 AND S_CNTR_CODE = '"..cntr_code.."'"
    local action = 
    {
        {
            action_type = "set_query_condition",
            value = {
                condition = strCondition,
                order = "S_CELL_NO",
                page_name = "当前任务"
            }            
        }
    }
 
    nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action)  )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo ) end 
 
end