fy36
2025-05-14 a37aca60ff9914b0abb710f04118b22420f4f398
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
--[[
    编码: JX-52-20
    名称: 配盘明细-出库分拣-跳过当前任务
    作者:HAN  
    日期:2025-3-15
 
    级别:项目
    
    函数: JumpCurTask
    功能:
        -- 当前出库任务(配盘明细)设置为完成 实际出库数量 = 0 ,取消数量 = 计划出库数量
        -- 如果当前出到站台的料箱的出库任务全部完成即可创建 【料箱回库】作业    
 
    更改记录:
 
--]]
wms_wh = require( "wms_wh" )
wms_cntr= require( "wms_container" )
jx_base= require( "jx_base" )
 
function JumpCurTask ( strLuaDEID ) 
    local nRet, strRetInfo
    local runtime_parameter
    nRet, runtime_parameter = m3.GetRuntimeParam(strLuaDEID)
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "GetRuntimeParam失败! "..runtime_parameter ) end
    -- 获取【组盘输入】面板的参数
    local parameter
    nRet, parameter = m3.GetRuntimePanel_InputParamter( strLuaDEID, runtime_parameter.panel, "出库分拣" )
    if ( nRet == 1 ) then 
        mobox.setInfo( strLuaDEID, "没有定义'出库分拣'面板参数!")
        return 
    end
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), parameter ) end 
    if ( parameter == nil ) then return end
    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.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end 
    local obj_attrs = json.decode( strRetInfo ) 
    local qty = lua.Get_NumAttrValue( obj_attrs[1].value )  
 
    if ( qty == 0 ) then return end
    
    -- 设置【配盘明细】状态 = 2(分拣完成)
    local strCondition = "S_ID = '"..id.."'"
    local strUpdateSql = "N_B_STATE = 2, F_ACC_P_QTY = 0"
    nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Distribution_CNTR_Detail", strCondition, strUpdateSql )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "更新【配盘明细】信息失败!"..strRetInfo ) end  
 
    local action 
    nRet, action = jx_base.Distribution_CNTR_PostProcess( strLuaDEID, parameter )
    if ( nRet ~= 0 ) then
        mobox.stopProgram( strLuaDEID, action )
        return
    end
    nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end 
 
end