1
Jianw
9 天以前 70f29da38121b9a467841253e3268feb5df02902
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
69
70
71
72
73
74
75
76
77
78
79
--[[
    编码: GK-52-17
    名称: 出库任务完成
    作者:HAN  
    日期:2025-7-7
 
    级别:项目
    
    函数: TaskFinish
 
    功能:
      
    更改记录:
 
--]]
 
gk_base = require( "gk_base" )
 
function TaskFinish ( strLuaDEID ) 
    local nRet, strRetInfo
 
    m3.PrintLuaDEInfo( strLuaDEID )
    lua.DebugEx( strLuaDEID, "parameter --> ", parameter )
 
    local parameter
    nRet, parameter = m3.Get_3053_PanelParameter( strLuaDEID, "出库分拣" )
    if nRet ~= 0 then
        wms_base.Notice_Audio( strLuaDEID, parameter, "error.mp3" ) 
        return        
    end
    
 
 
    local station = parameter.station or ''  
    if ( station == "") then
        wms_base.Notice_Audio( strLuaDEID, "'组盘输入'面板必须有 station 参数!", "error.mp3")
        return         
    end
    local groupID = "Station:"..station
    
    local id = parameter.id                 -- 当前点中的出库任务标识
    local dc_no = parameter.dc_no           -- 当前点中的出库任务所属配盘号
    if ( dc_no == nil or dc_no == "") then
        mobox.setInfo( strLuaDEID, "'出库分拣'面板必须有 dc_no 参数!")
        return         
    end
 
    nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "F_QTY" ) 
    if ( nRet ~= 0 )  then 
        lua.Stop( strLuaDEID, "获取当前编辑属性失败! "..strRetInfo )
        return
    end 
    local obj_attrs = json.decode( strRetInfo ) 
    local qty = lua.Get_NumAttrValue( obj_attrs[1].value )  
    local acc_p_qty = qty
    local action = {}
 
    -- 设置【配盘明细】状态 = 2/PickingOK(完成分拣)
    local strCondition = "S_ID = '"..id.."'"
    local strUpdateSql = "N_B_STATE = "..DC_DETAIL_STATE.PickingOK..", F_ACC_P_QTY = "..acc_p_qty
    nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Distribution_CNTR_Detail", strCondition, strUpdateSql )
    if ( nRet ~= 0 ) then  
        lua.Stop( strLuaDEID, "更新【配盘明细】信息失败!"..strRetInfo )
        return
    end  
 
    nRet, action = gk_base.Distribution_CNTR_PostProcess( strLuaDEID, parameter )
    if ( nRet ~= 0 ) then
        lua.Stop( strLuaDEID, action )
        return
    end            
 
    nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) )
    if ( nRet ~= 0 ) then 
        lua.Stop( strLuaDEID, "setAction失败! "..strRetInfo..' action = '..strAction ) 
        return
    end 
 
end