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
--[[
    编码: WMS-38-20
    名称: 任务-PDA-任务完成
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: TaskFinish
 
    功能:
        设置人工搬运任务完成
 
    更改记录:
 
--]]
wms_task = require( "wms_task" )
 
function TaskFinish ( strLuaDEID ) 
    local nRet, strRetInfo
    local strUserLogin, strUserName
 
    nRet, strUserLogin, strUserName = mobox.getCurUserInfo( strLuaDEID )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前操作人员信息失败! "..strUserLogin ) end
    -- step1: 获取当前【容器货品明细】对象
    local task
    nRet, task = m3.GetSysCurEditDataObj( strLuaDEID, "Task" )
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..task ) end 
 
    -- 强制任务完成
    nRet, strRetInfo = wms.wms_TaskFinish( strLuaDEID, task.code )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "任务编码='"..task.code.."'的任务设置完成失败!"..strRetInfo ) end         
 
    -- 增加 任务动作
    local task_action = m3.AllocObject(strLuaDEID,"Task_Action")
    task_action.task_code = task.S_CODE
    task_action.action_code = 10
    task_action.action = "完成"
    task_action.eq_code = strUserName
    task_action.eq_type_name = '叉车搬运工'
    nRet, strRetInfo = m3.CreateDataObj( strLuaDEID, task_action )
 
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), '创建【任务动作】对象失败!'..strRetInfo ) end 
 
 
    local strAction = '[{"action_type":"goback_to_pre_page","value":""}]'
    nRet, strRetInfo = mobox.setAction(strLuaDEID, strAction)
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction错误: "..strRetInfo) end    
 end